Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/if_wmreg.h
RevisionDateAuthorComments
 1.131  29-Jan-2024  msaitoh wm(4): Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.

The iqdrops counter should include not only MPC(Missed Packet Count)
but also RQDPC(Receive Queue Drop Packet Count). Same as ixgbe(4) and igc(4).

Note that the RQDPC is not currently counted because SRRCTL_DROP_EN
is not set.
 1.130  11-May-2023  msaitoh Add some new event counters.

Add the following counters for 82575 and newer except 80003, ICHs and PCHs:
- Only 82576 document describes about the circuit breaker,
so the following two might be only for 82575:
- Circuit Breaker TX Manageability Packet
- Circuit Breaker RX Dropped Packet
- 82575's document doesn't describe the following two, but we can see
the same value as GO{T,R}C have:
- Host Good Octets RX
- Host Good Octets TX
- 82575's document doesn't describe the LENERRS (Length Errors) counter.
I don't know if it has.
- Perhaps Non-SerDes/SGMII devices don't have SCVPC
(SerDes/SGMII Code Violation Packet) register. We don't care if
it's SerDes/SGMII or not for now.
- HRMPC (Header Redirection Missed Packet) appears only once
in 8257[56]'s datasheet. FreeBSD's igb counts it, so we do, too.
- Count the following two for I350 and newer. I don't know if PCHs have:
- EEE TX LPI
- EEE RX LPI
 1.129  11-May-2023  msaitoh Some statistics registers were replaced with new counters.

- 0x403c was CEXTERR(Carrier Extension Error). 82575 and newer except 80003,
ICHs and PCHs have HTDPMC(Host Tx Discarded Packets by MAC). I don't really
know for 82575. The 82575 datasheet say nothing about it.
- The following two are changed for circuit breaker. Only 82576's datasheet
describes abut it, so the registers might be only for 82576.
Use those registers for 82575 and newer except 80003, ICHs and PCHs just in
case.
- 0x40fc was TSCTFC(TCP Segmentation Context Tx Fail). It was replaced by
the CBRMPC(Circuit Breaker Rx Manageability Packet) register.
- 0x4124 was ICRXOC(Interrupt Cause Receiver Overrun). It was replaced by
the HTCBDPC(Host Tx Circuit Breaker Dropped Packet) register.
- From 0x4104 to 0x4124:
- For 0x4124, 82575's datasheet says it's not changed(ICRXOC).
I don't know if it's correct. We use new HTCBDPC register for 82575.
- 82576 and newer changed the meaning.
- I don't know for 80003, ICHs and PCHs. Don't count those registers.
At least, those registers in PCH2 and PCH_CNP are all zero.
 1.128  19-Oct-2022  msaitoh branches: 1.128.2;
Fix typo. No functional change. OK'd by knakahara.
 1.127  22-Jul-2022  msaitoh Add more statistics countes.

- Add many statics counters that the chip has.
- Attach event counters only if available.
 1.126  20-Jul-2022  msaitoh Modify comment. Use __BIT() a little. No functional change.
 1.125  22-Dec-2021  skrll Fixup NQTXC_CMD_{TCP,UDP} after previous
 1.124  22-Dec-2021  skrll In a close run thing use #define<tab> everywhere for consistency
 1.123  22-Dec-2021  skrll Use __BIT() some more. Same code before and after.
 1.122  20-Dec-2021  skrll Trailing whitespace
 1.121  05-Nov-2021  msaitoh Fix comment. No functional change.
 1.120  16-Sep-2020  msaitoh Add a workaround for jumbo frame on PCH2 and newer. Tested by chs@.

- Add wm_lv_jumbo_workaround_ich8lan() and use it. From FreeBSD.

XXX For KUMCTRLSTA_OFFSET_HD_CTRL register modification, it's doubtful.
FreeBSD and Linux do the same thing that they set the same value on both
jumbo frame's enable case and the disable case. It seems the default value
is 0x0b0c and it's not changed on the enable case, so it might be a bug
on the enable case or the modification is not required.

- Rename I219_UNKNOWN1 to I82579_UNKNOWN1.
 1.119  08-Jan-2020  msaitoh - Fix SFF_SFP_ETH_FLAGS_100FX. It's not 0x10 but 0x20.
- Define SFF_SFP_ETH_FLAGS_100LX with 0x10.
 1.118  11-Dec-2019  msaitoh Add SFP support part 1. The code for SerDes and SGMII setting is not include
in this commit. SFP module removal interrupt detects but not used yet:
- Detect SFP's 1000BASE-SX, 1000BASE-LX, 100BASE-FX and 1000BASE-T correctly.
- Detect the Media Auto Sense feature. Not supported yet.
- Add comment.
 1.117  11-Dec-2019  msaitoh - Set CTRL_ILOS(Invert loss of signal) bit correctly on 82580 port 1, 2, 3 and
newer chips. This change fixes a bug that some fiber, serdes or SFP devices
don't detect the link status correctly.
XXX We should check for other NVM reads if they have the same problem. One of
the solution to avoid this type of bug is to check the register layout
in wm_nvm_read().
- Use __BIT()
- Add comment
 1.116  11-Dec-2019  msaitoh No functional change:
- Add defintion of CONNSW register and PCS_NPTX (not used yet).
- Add some bit definitions of PCS_LCTL.
- Renae macro.
- Fix comment. Add comment.
- KNF.
 1.115  23-Jul-2019  msaitoh branches: 1.115.2;
Define RETA_ENTRY_MASK_Q(used in RSS redirection table) correctly.
Found by UBSan.
 1.114  07-Jun-2019  msaitoh Use unsigned. Found by UBSan. OK'd by kamil.
 1.113  28-Feb-2019  khorben Typo (s/vaule/value/)
 1.112  31-Jan-2019  msaitoh Add some workarounds which use EMI register or EEE related:
- PCH only: Add workaround for link disconnects on a busy hub in half duplex.
- PCH and PCH2 only: Set MSE higher to enable link to stay up when noise is
high.
- PCH2 only: Drop link after 5 times MSE threshold was reached.
- PCH2 only: Set EEE LPI Update Timer to 200usec.
- For PCH2 and newer: When connected at 10Mbps half-duplex, some parts are
excessively aggressive resulting in many collisions. To avoid this, increase
the IPG and reduce Rx latency in the PHY.
- For I21[789] and if EEE is enabled: Disable LPLU if both link partners
support 100BaseT EEE and 100Full is advertised on both ends of the link, and
enable Auto Enable LPI since there will be no driver to enable LPI while in
Sx.
 1.111  20-Dec-2018  msaitoh - Don't setup WoL on non-WoL capable port.
- Setup PHY wakeup feature on PCH and newer. Tested on Thinkpad X220.
 1.110  14-Dec-2018  msaitoh - Fix availability detection of WoL on some chips. This change has no effect
other than dmesg because WM_F_WOL is currently not used to change the behavior:
- For ICH/PCH, check the capability not from NVM but from the WUC register.
Check the value before clearing the register.
- 82580 and newer have per-port NVM block, so read the area correctly.
Note that 82580, I350 and I354 may have PCI function 2 and 3.
- Some devices can't detect WoL capability neither from NVM nor from WUC.
Use PCI device ID and the function number.
- Print the WUS (WakeUp Status) register bits when resume.
 1.109  19-Nov-2018  msaitoh - Control TX/RX descriptor snooping control bits on ICH8 and newer.
Only on ICH8, No-snoop bits are opposite polarity. On my Thinkpas X61,
the default value of this bits are all zero, so this commit changes
the snoop function enable on the machine. I tested with some other
PCH machines and those bits are all zero (enable snoop by default),
so this commit won't affect to some machines.
- Disable relax ordering on 82546GB(Device ID 0x1099 and 0x10b5) or >= ICH8.
Same as other OSes.
 1.108  02-Nov-2018  msaitoh Add workaround for DMA hang problem which result in TX device timeout on
PCH_LPT with I218. Same as FreeBSD and Linux. This woraround is only for
device ID 0x155a, 0x15a2, 0x1559 and 0x15a3. I observed this problem on my
Shuttle DS57U's I218 port six times in two months.
 1.107  12-Apr-2018  msaitoh branches: 1.107.2;
No binary change:
- Sort registers.
- Lowercase hexadecimal value.
 1.106  10-Apr-2018  msaitoh SW PHY Config Enable bit for ICH8 B0 stepping is not bit 1 but bit 0.
 1.105  22-Nov-2017  msaitoh branches: 1.105.2;
Revert if_wmreg.h 1.104 and if_wm.c 1.542. It's not required to mask other
than VLAN ID bits in VLAN tag.
 1.104  23-Oct-2017  knakahara fix wm(4) vlan panic. Reported and tested by Tom Ivar Helbekkmo, thanks.

wm(4) used PRI bits and CFI bit as vlantag by mistake. It is found out
by if_ether.h:r1.67.

XXX need pullup-8
 1.103  26-Jul-2017  msaitoh - Our MII readreg/writereg API has not way to detect an error.
kmrn_{read,write}reg() are not used for MII API, so it's not required for
these functions to use the same API. So,
- Change return value as error code.
- Change register vaule from int to uint16_t.
- read: pass pointer for uint16_t as an argument.
- Check return value on caller side.
- Check whether it's required to use MDIC workaround for 80003 or not in
wm_reset(). If the workaround isn't required, don't use the workaround code
in wm_gmii_i80003_{read,write}reg.
 1.102  13-Jul-2017  msaitoh - Call wm_kmrn_lock_loss_workaround_ich8lan() before any PHY access in
wm_linkintr_gmii().
- Register access in wm_kmrn_lock_loss_workaround_ich8lan() now works
correctly. Enable this function.
- Configure the LCD with the extended configuration region in NVM if it's
required.
- Add debug printf.
 1.101  12-Jul-2017  msaitoh Disable D0 LPLU on 8257[12356], 82580, I350 and I21[01], too. Before this commit,
above devices and non-PCIe devices accessed wrong register.
 1.100  26-Jun-2017  msaitoh - Make new wm_phy_post_reset() and use this function at all location after
reseting phy.
- Move the location of calling wm_get_hw_control. Same as Linux.
- Add I219 specific wokaround for legacy interrupt. From OpenBSD.
- Move the location of calling wm_lplu_d0_disable().
- Fix latency calculation in wm_platform_pm_pch_lpt().
- Set OBFF water mark and enable OBFF on PCH_LPT and newer.
 1.99  26-Jun-2017  msaitoh - Fix wm_set_ral():
- Fix a bug that a RAL was written at incorrect address when the index number
is more than 16 on 82544 and newer.
- The layout of RAL on PCH* are different from others.
- Remove wrong comment.
 1.98  28-Feb-2017  knakahara branches: 1.98.6;
fix EITR setting.

+ 82574
- add EITR setting, that is MSI-X mode interrupt interval
+ 82575
- fix EITR value. 82575's EITR usage is the same as legacy (not NEWQUEUE)
controllers
- apply workaround which 82575's EITR does not have CNT_INGR bit
+ other NEWQUEUE controllers
- fix interrupt interval field. NEWQUEUE (include 82575) controllers'
interrupt interval field is 2:14
- use CNT_INGR bit which avoid to overwrite counter

tested 82574, 82575 and I354.
ok by msaitoh@n.o.
 1.97  02-Feb-2017  msaitoh Fix typo in comment.
 1.96  01-Feb-2017  knakahara tabify
 1.95  16-Jan-2017  knakahara support {extended, advanced} receive descriptor for wm(4).

support below two receive descriptors.
- extended descriptor (used by 82574 only)
- advanced descriptor (used by 82575 and newer)

SPH(split header buffer) is not supported yet.

ok by msaitoh@n.o.
 1.94  13-Dec-2016  msaitoh branches: 1.94.2;
- Change to use 2500Base-KX correctly on C2000(I354). It worked, but the
output of ifconfig and if_baudrate was not good. Tested by nils@:
- The STATUS_TBIMODE bit in the STATUS register is deleted since 82575,
so check for 82575 and newer first and then check for old devices.
- Check the 2P5_SKU and 2P5_SKU_OVER bit for KX.
- Set IFM_2500_SX instead of IFM_1000_SX for 2.5G.
- Check SERDES's speed directly from the PCS layer (PCS_LSTS register) for old
devices.
- Style fix.
 1.93  16-Nov-2016  msaitoh Sync wm_smbustopci() with Linux and FreeBSD. This change effects PCH and
newer devices.
 1.92  16-Nov-2016  msaitoh Add three workarounds for PCH_{LPT,SPT}.
 1.91  14-Nov-2016  msaitoh Sort registers. No functional change.
 1.90  11-Nov-2016  msaitoh The MEHE bit in the CTRL register is not bit 17 but 19.
 1.89  06-May-2016  msaitoh branches: 1.89.2;
Basic support for I219. It doesn't work on I219, so it's disabled.
 1.88  25-Dec-2015  msaitoh - Fix RAL table's size of PCH2 and PCH_LPT.
- PCH_LPT (and newer device) is required to check FWSM_WLOCK_MAC bit to
determine the range of the RAL.
- Fix typo in comment and modify comment by tnn@.
- Rename wm_check_reset_block() to wm_phy_resetisblocked() and make it returns
bool. No functional change.
 1.87  27-Oct-2015  msaitoh Move the definition of CTRL_EXT_PHYPDEN and use __BIT(). No binary change.
 1.86  23-Oct-2015  msaitoh PHY_CTRL_GBE_DIS is not bit 4 but bit 6. This change has no any effect by
default because WM_WOL is not defined yet and
m_kmrn_lock_loss_workaround_ich8lan() is broken.
 1.85  13-Oct-2015  knakahara fix RXCSUM_CRCOFL bit of WMREG_RXCSUM register.
 1.84  13-Oct-2015  knakahara support RX multiqueue.

ok by msaitoh@n.o
 1.83  13-Oct-2015  knakahara change const value register macros to macro expressions to support multiqueue.
 1.82  08-Oct-2015  msaitoh - ACK Accelerate Disable in the RFCTL register is not bit 13 but 12.
No binary change because this definition have not used yet.
- Add ACK data Disable bit's definition.
 1.81  30-Sep-2015  knakahara fix IVARs offset for 82580 and newer.
 1.80  30-Sep-2015  msaitoh - Add workaround for 82574 Errata 25 and 82583 Errata 12 "Dropped RX packets"
and for 82573 (unknown). Set GCR_L1_ACT_WITHOUT_L0S_RX bit. The NVM Image
version 2.1.4 and newer have this workaround.
- Print the NVM image version on 82583, too.

Pointed out by joerg@.
 1.79  07-Sep-2015  msaitoh - Check iNVM's image version and print it.
- Update TODO.
 1.78  13-Jun-2015  msaitoh Add MSI/MSI-X support written by Kengo Nakahara. Some old devices' support
is written by me. It's disabled by default. If you'd like to use, define
WM_MSI_MSIX.

Tested with:
8254[3405617] (INTx even if it has MSI CAP because of a errata)
8257[12], 82583 ICH8, ICH10, PCH2, PCH_LPT(I21[78]) (MSI)
8257[456], 82580, I35[04], I21[01] (MSI-X)

Not tested:
82542, 82573, 80003, ICH9, PCH,
 1.77  06-Jun-2015  msaitoh - Add workaround for I210 Errata 25 and I211 Errata 10.
- Add wm_gmii_gs40g_{read|write}reg() and use it to access non-standatrd
page.
- Add wm_pll_workaround_i210() and call it when
chip is i211
chip is i210 and it use INVM
chip is i210 and NVM image version < 3.25
- Add comment
- Rename macros.
 1.76  06-Jun-2015  msaitoh Print NVM image version.
 1.75  06-Jun-2015  msaitoh Revert previos. Sorry, I committed in another working directory...
 1.74  06-Jun-2015  msaitoh Print NVM image version.
 1.73  02-Jun-2015  msaitoh Fix a lot of bugs to make 82575 and newer's SERDES based systems work.
- Add SERDES specific functions.
- Fix IO pin configuration.
- Reset autonego timer when link becomes up.

TODO:
- Fix a bug that SFP ROM can't read.
- Perhaps some work is required for 8257[12] serdes systems.
- Remove duplicated code in TBI's link related functions.
 1.72  22-May-2015  msaitoh - Currently, WM_F_EEE bit is not set on all chips. it's intended to not
to use all of EEE fuctions but wm_set_eee_i350() leaves IPCNFG_10BASE_TE
bit and it causes link negotiation problem on some old switches. Disable
10BASE-Te function, too.
- Call wm_set_eee_i350() on some chips, too.
 1.71  16-May-2015  msaitoh Add support iNVM (integrated Non-Volatile Memory) for I21[01]. This change
fixes a bug that a MAC address is wrongly set on iNVM machines and NICs.
Tested with Shuttle DS57U(iNVM based) and other non iNVM based I210 machines.
 1.70  15-May-2015  msaitoh Fix typo in comment.
 1.69  04-May-2015  msaitoh For 82576 and newer devices, the PBA register is deleted. Don't write PBA
for those chips. Also change the calculation of RX packet buffer size in
new way.
 1.68  04-May-2015  msaitoh Set ICH9 and ICH10's PBA size to 14K if the RX buffer size is
more than 4096. Almost the Same as other OSes
 1.67  04-May-2015  msaitoh Remove WMREG_TQSA_LO and WMREG_TQSA_HIGH. Those registers
are not described in documents and other OS's drivers don't
access it.
(I have no the first chip(82542)'s document. Those registers
might be described in the document).
 1.66  15-Feb-2015  msaitoh - Initialize some hardware bits for 8257[1234], 82583, 80003, ICH* and PCH*.
Some of them are workaround code. From other *BSDs, Linux and documents.
- Add comment.
- Fix typo in comment.
 1.65  24-Oct-2014  msaitoh branches: 1.65.2;
Simplify. No functional change.
 1.64  24-Oct-2014  msaitoh Fix a bug that the offset of alt MAC address is wrongly calculated to 0
when alt MAC address function is really used. This bug does not appear
as real bug if the same MAC address is written in the default location
and alt MAC address's location.
 1.63  03-Sep-2014  msaitoh Read SFF SFP ROM and configure driver from the value.
 1.62  01-Sep-2014  msaitoh Fix a bug that wm_get_swsm_semaphore() timed out when attaching device on some
machines.
- Calculate NVM word size correctly.
- Determine timeout value based on the NVM word size.
 1.61  29-Aug-2014  msaitoh No binary change:
- Move some NVM related macros from if_wm.c to if_wmreg.h.
- Rename some macros for consistency.
 1.60  31-Jul-2014  msaitoh branches: 1.60.2;
Fix fiber link problem (PR#44776 and PR#30880). Tested with 82543GC, 82544EI,
82545EM, 82546GB 82571EB and 82572EI fiber cards.
- Don't use the RXCFG interrupt. It's not required and the interrupt is very
heavy (a lot of interrupts). Same as {Free,Open}BSD.
- Modify wm_tbi_mediachange() to be close to em_setup_fiber_serdes_link()
of {Free,Open}BSD. At least, don't forget to set duplex setting.
- WM_T_82545 is not 1000base-SX but 1000base-LX. Same as FreeBSD. Tested with
my own 82545EM card.
 1.59  25-Jul-2014  msaitoh - Call wm_set_pcie_completion_timeout() on I350, I354, I210 and I211, too.
Same as FreeBSD and OpenBSD.
- Drop PHPM_GO_LINK_D bit in WMREG_PHPM on some chips. From FreeBSD.
 1.58  25-Jul-2014  msaitoh No functional change:
- move NVM related values to the bottom.
- sort in register's address.
 1.57  11-Jul-2014  msaitoh Fix some bugs realted to semaphore. This change fixes a problem which
was exposed in if_wm.c rev. 1.271. Tested by riastradh@.
- Clear the SMBI bit in SWSM register before accessing NVM and PHY in
wm_attach(). Same as FreeBSD.
- Fix a bug that 82573 doesn't put the hardware semaphore. Same as
FreeBSD r256200.
 1.56  11-Apr-2014  msaitoh Fix the definition of CTRL_GIO_M_DIS. This bit is not bit 3 but bit 2.
Reported by pooka@.
 1.55  29-Dec-2013  msaitoh branches: 1.55.2;
Add support For I354(C2000 interna Ethernet controller):
- Add I354 support.
- Fix SGMII+MDIO case. SGMII+I2C is not supported yet.
- Not tested well.
- Sprinkle "XXX" to check later.
 1.54  25-Jun-2013  msaitoh branches: 1.54.2;
Sync the wm_enable_mng_pass_thru() function with FreeBSD. Don't check
MANC_EN_MAC_ADDR_FILTER bit. Add 82574 and 82583 specific check. This
modification may change the setting of WM_F_HAS_MANAGE flag on some machines.

Sync the wm_release_manageablilty() fucntion with FreeBSD. Set MANC_ARP_EN.
This change enables HW ARP function when entering suspend.

When the chip is 82580(ER) or I350, set WM_F_ASF_FIRMWARE_PRES flag and
check for the WM_F_ARC_SUBSYS_VALID flag. Same as FreeBSD.
 1.53  19-Jun-2013  msaitoh Add ECC support for the packet buffer. Only 82571 and I21[78] support ECC.
 1.52  21-Apr-2013  msaitoh Delete "PCI_" from PCIX and PICE capability registers.
 1.51  18-Apr-2013  msaitoh Add support I21[01]. Only tested with my own I210-T1 Ethernet Server Adapter.
 1.50  13-Feb-2013  msaitoh No functional change.
- Fix comment.
- Use macro.
 1.49  07-Feb-2013  msaitoh Fix RAL_TABSIZE for ICH8, 82576, 82580 and I350.
 1.48  29-Aug-2012  bouyer branches: 1.48.2;
Make vlan and all ip/ip6 checksum offload work for the I350.

On newer devices, when using the legacy TX descriptors, vlan-related flags
that were set on the last descriptor of a packet have to be set on the
first one.
For tso/checksum offloads, a new "advanced" descriptor format has to be
used.

Change wcd_txdescs to a union defining all types of descriptors (they
are all 16-bytes wide).
Define a new tx function wm_nq_start(), which handle newer devices.
There is some code duplication with wm_start(), but adding support to
the existing wm_start() would make it a if () {} else {} maze. This also
allows to get rid of some workaround for older chips that are not needed
here.
Use wm_nq_start() instead of wm_start() for the I350 (this should probably
be for all WM_F_NEWQUEUE devices, but I have no hardware but the I350 to
test). Call ifp->if_start() instead of wm_start() where is matters.

Tested on a I350, and a i80003 (which use the old format), both with and
without vlans, with and without checksum offloads.
 1.47  25-May-2012  msaitoh Add support Intel I350 Ethernet.
 1.46  20-Dec-2011  dyoung branches: 1.46.2;
Mark all of the Rx descriptor fields 'volatile' so that the compiler
will not re-order accesses. Some versions of GCC (such as one in NetBSD
5.x) definitely do re-order reads from these fields if they're not
marked volatile.
 1.45  20-May-2011  msaitoh branches: 1.45.4; 1.45.8;
Add PCH2 support.
 1.44  14-Jul-2010  msaitoh branches: 1.44.2;
- s/TBDA/TDBA/. It stands for Transmit Descriptor Base Address.
- The document says that the TDH register must be set after
TCL.EN is set on 82575 and newer devices.

TODO:
- ip4csum doesn't work on 82575 and newer devices (reported by Paul Goyette),
so we have to fix it.
 1.43  25-Jun-2010  msaitoh fix comment.
 1.42  25-Jun-2010  msaitoh Add some code to support 82580[ER]. Tested on my own I340-T4.

- Fix CTRL_EXT_SWDPIN() and CTRL_EXT_SWDPIO() macros. The bit order of the
SW definable pin is not 6543 but 3654!!!

- Rewrite the code to read MAC address from eeprom.

- Add some code to support 82580.

TODO:
- ukphy -> somephy
 1.41  25-Jun-2010  msaitoh The GIO master enable bit in STATUS register is not bit 16 but bit 19.
It will fix a problem in the reset sequence on PCI-e chips.
 1.40  07-Mar-2010  msaitoh branches: 1.40.2;
- Add code for WOL, ASF, IPMI and Intel AMT.
- wm_enable_wakeup() is disabled by default. If you want to use WOL with
the Magic Packet, define WM_WOL.
- Add the following flags:
WM_F_ASF_FIRMWARE_PRESENT
WM_F_ARC_SUBSYSTEM_VALID
WM_F_HAS_AMT
WM_F_HAS_MANAGE
WM_F_WOL
- Add wm_suspend() and wm_resume(). Give/get the control to/from the
firmware.
- Need more work for PCH. See wm_enable_phy_wakeup().
- Enable wm_get_hw_control() for 82574 and 82583.
- Add Yet another workaround for ICH8.
- Add wm_igp3_phy_powerdown_workaround_ich8lan() for power down problem
on D3.
 1.39  07-Mar-2010  msaitoh Add two workarounds for ICH8 with igp3.
- Workaround for 82566 Kumeran PCS lock loss.
- WOL from S5 stops working.
 1.38  16-Feb-2010  msaitoh Add support for 82575, 82576 and 82580(ER).
- Apply the patch for 82575 from Wolfgang Stukenbrock (PR#42422). We use
only one RX ring and with the legacy mode.
- Add support for 82576.
- Partial support for 82580.
- Partial support for the serdes systems.
 1.37  16-Feb-2010  msaitoh indent, tabify and remove extra spaces.
 1.36  04-Feb-2010  msaitoh branches: 1.36.2;
- Count Receive error, CRC error, Alignment error, Symbol error, Sequence
error, Carrier extension error and Receive length error into ierror.
Fixes PR#30349 reported by UMEZAWA Takeshi.
- Count Missed packet (rx fifo overflow) and Receive no buffers (rx ring full)
into iqdrops.
 1.35  14-Jan-2010  msaitoh Fixes the rx stall problem on 82578 by MANY workaround code.
We need more work for 82577.
 1.34  12-Jan-2010  msaitoh - Add i82567LM-2 i82567LM-4 i82567V-3 LAN controller.
- Reset GMII interface after wm_reset() in wm_init().
- Rework for assigning mii_{read,write}reg(). Use PCI product ID to identify
the PHY.
- Add code about LPLU(Low Power Link Up) function. Now we can linkup 1000BaseT
on PCH. It seems that we have to do the same work for ICH9.
 1.33  11-Jan-2010  msaitoh Add partial support for PCH. We have to do more work for PCH. Especially
I don't know what driver i82578 should be attached to. makephy? or atphy?
MII_OUI() says that the PHY is from Attansic (== Atheros). Intel's e1000
driver says that it's close to makphy...

I can't link up at 1000BaseT yet...
 1.32  07-Jan-2010  msaitoh Make wm_reset() and wm_gmii_reset() close to e1000 driver.
At least, this change make wm_attach() stable on ICH9.
 1.31  07-Jan-2010  msaitoh bugfixes:
- add missing break in wm_reset()...
- fix the offset of WMREG_PBS...
- fix length of some delay()s in wm_gmii_reset()
 1.30  05-Jan-2010  msaitoh Fix the checking of jumbo frame function though I don't know whether
the function wokrs or not...

Remove the extra macro definition for the offset 0x1a in EEPROM.
 1.29  29-Dec-2009  msaitoh - Fix an incorrect test for WM_F_EEPROM_INVALID since rev. 1.183. Some old
chips don't set EECD_EE_PRES.
- Fix a bug that both WM_F_EEPROM_SPI and WM_F_EEPROM_FLASH are set.
- Add a missing decrement for a timeout reported by Wolfgang Stukenbrock
in PR#42422.
- Add support for i82583V.
- PBA setting for i82574 is not 12K but 20K.
- Enable checking the management mode on 82574.
 1.28  14-Jul-2009  msaitoh Some fixes for i80003 and ICH{8,9,10} from e1000 driver and document:

Add setting for KABGTXD register for ICH{8,9,10}.

ICH9 and ICH10 has no FCAL, FCAH and FCT like ICH8.

Add special setting for FCTTV and TCTL_EXT register for i80003

The special setting for TIPG is only for i80003.

Some of kumeran settings are only for i80003's bugs.

Add some ICH10 fixes.
 1.27  07-Apr-2009  msaitoh Fix about TBI mode. This fix doesn't influence MII mode.
- Fix SWDPIN(1)'s polarity on some chips.
- Fix flow control stuff (includes PR#32009).
- Stop RXCFG storm. It ocours easily.
- And more fix about autonego.

Tested on PRO/1000F, PRO/1000XF and PRO/1000 MF.
 1.26  20-Mar-2009  msaitoh Examine the management mode and mark DRV_LOAD (for ICH{8,9,10},80003,
8257{1,2,3,4}).

Add some error's printf().

Make the bank detect routine into the function.
 1.25  10-Mar-2009  msaitoh add an entry for 82567LF-3.
fix the register access for ICH10DO.
 1.24  25-Dec-2007  perry branches: 1.24.10; 1.24.18; 1.24.20; 1.24.24; 1.24.26;
Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.23  28-Aug-2007  msaitoh branches: 1.23.6; 1.23.8; 1.23.12;
add ICH9
need more work?
 1.22  29-Apr-2007  bouyer branches: 1.22.2; 1.22.6; 1.22.8;
Add support for ICH8 (i82801H) LAN, from FreeBSD.
Should work on:
i82801H IFE (GT) LAN Controller
i82801H IFE (G) LAN Controller
i82801H (M_AMT) LAN Controller
i82801H (AMT) LAN Controller
i82801H LAN Controller
i82801H (IFE) LAN Controller
i82801H (M) LAN Controller

tested with: Intel i82801H (AMT) LAN Controller, rev. 2
 1.21  16-Nov-2006  yamt branches: 1.21.2; 1.21.4; 1.21.8; 1.21.10;
wm: add IPv6 rx tcp/udp checksum offloading.
 1.20  21-Oct-2006  bouyer Add support for the Intel 80003 Gigabit Ethernet controller (found e.g. in
newer server chipsets) to wm(4), from the FreeBSD em(4) driver.
While there, add a few other Intel Ethernet controller that should work as
is.
Properly update the RX error and TX collision counters.
Add ikphy(4), a driver for the Intel i82563 Kumeran 10/100/1000 Ethernet PHYs
 1.19  10-Jun-2006  msaitoh branches: 1.19.6; 1.19.8;
o i82573 doesn't support jumbo frame
o set PBA for i8257[123]
o set MULA when sc_type == i8257[123]
 1.18  10-Jun-2006  uebayasi KNF.
 1.17  10-Jun-2006  msaitoh fix TX_COLLISION_DISTANCE_FDX and TX_COLLISION_DISTANCE_HDX (swapped).

add some register definitions (EERD, EEWR).
 1.16  11-Dec-2005  christos branches: 1.16.4; 1.16.8; 1.16.14;
merge ktrace-lwp.
 1.15  07-Aug-2005  yamt fix a typo(?) in an unused macro. (WRX_ST_ISXM -> WRX_ST_IXSM)
 1.14  18-Feb-2005  briggs branches: 1.14.4; 1.14.6;
Update the interrupt mitigation support.
Actually initialize the interrupt throttling register.
Actually initialize the tx and tx absolute interrupt delay timer regs.
Update default values for the rx and tx delay timers.
Inspired by Zdenek Salvet in PR kern/29373.
 1.13  05-Oct-2004  thorpej branches: 1.13.4; 1.13.6;
Largest Tx descriptor buffer size is actually 4K.
 1.12  05-Oct-2004  thorpej - Add some useful constants related to the Packet Buffer Allocation
register.
- Add the Receive and Transmit Data FIFO registers.
 1.11  16-May-2004  thorpej Add flow control support, based on work by HITOSHI Osada.
 1.10  19-Feb-2004  thorpej branches: 1.10.2; 1.10.4;
s/WTC_DTYP_D/WTX_DTYP_D/
 1.9  14-Jan-2004  tsutsui Fix hardware cksum problem on big endian machines.
Tested on macppc by HATANO Hiromichi.

Note I guess this bug could be fixed only adding one htole32(),
but I'd rather clean up endianness handling:
- Use htole32() only to accesses against DMA descriptors.
- Don't use uint32_t union member with htole32()/le32toh()
to access uint8_t/uint16_t descriptors.
- Add le32toh() in some DPRINTF.
(XXX: strictly speaking, bus_dmamap_sync() is needed for these DPRINTF)
 1.8  07-Nov-2003  thorpej Fix brain'o in PCIX speed detection. kern/23375 (John R. Shannon).
 1.7  21-Oct-2003  thorpej Fix a typo.
 1.6  21-Oct-2003  thorpej Add some additional register definitions needed for newer chips:
- Control register shadow
- SPI EEPROM stuff
 1.5  30-May-2003  matt branches: 1.5.2;
Use proper shift marcos for EXT. This makes the PHY on i83543 get
recognized. From Doug Donsbach <dldonsbach at tds dot net>
 1.4  18-Oct-2002  yamt fix typos; "wiseman" is 82542, not 82452.
 1.3  08-Aug-2002  thorpej Add support for the new i82540, i82545, and i82546 Gig-E chips. The
i82546 chip has 2 Gig-E interfaces in a single chip.

The main difference is these chips have a special handshaking protocol
for accessing the EEPROM (due to the shared nature on the i82546).
 1.2  14-Jul-2002  thorpej Correct the description of two bits in the TCP context descriptor.
 1.1  28-Mar-2002  thorpej branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Device driver for the Intel i82542, i82542, and i82544 Gigabit
Ethernet interfaces.
 1.1.8.3  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.8.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1  28-Mar-2002  jdolecek file if_wmreg.h was added on branch kqueue on 2002-06-23 17:47:47 +0000
 1.1.6.4  20-Jun-2003  msaitoh Pull up revision 1.5 (requested by matt in ticket #1299):
FIx to recognize the PHY on i83543 correctly.
 1.1.6.3  21-Nov-2002  tron Pull up revision 1.4 (requested by yamt in ticket #925):
fix typos; "wiseman" is 82542, not 82452.
 1.1.6.2  08-Nov-2002  tron Pull up revision 1.3 (requested by thorpej in ticket #650):
Add support for the new i82540, i82545, and i82546 Gig-E chips. The
i82546 chip has 2 Gig-E interfaces in a single chip.
The main difference is these chips have a special handshaking protocol
for accessing the EEPROM (due to the shared nature on the i82546).
 1.1.6.1  15-Jul-2002  thorpej pullup-1-6 ticket #499 (thorpej).

Original log message:
Correct the description of two bits in the TCP context descriptor.
 1.1.4.2  29-Aug-2002  gehenna catch up with -current.
 1.1.4.1  15-Jul-2002  gehenna catch up with -current.
 1.1.2.5  11-Nov-2002  nathanw Catch up to -current
 1.1.2.4  13-Aug-2002  nathanw Catch up to -current.
 1.1.2.3  01-Aug-2002  nathanw Catch up to -current.
 1.1.2.2  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.1  28-Mar-2002  nathanw file if_wmreg.h was added on branch nathanw_sa on 2002-04-01 07:46:28 +0000
 1.5.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.2.4  19-Oct-2004  skrll Sync with HEAD
 1.5.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1  03-Aug-2004  skrll Sync with HEAD
 1.10.4.3  12-Jan-2005  he Pull up revision 1.13 (requested by thorpej in ticket #898):
Largest Tx descriptor buffer size is actually 4K.
 1.10.4.2  08-Jan-2005  jdc Fix pull up merge error.
Pointed out by Martin J. Laubach.
 1.10.4.1  07-Jan-2005  jdc Pull up revision 1.12 (requested by thorpej in ticket #897)

- Add some useful constants related to the Packet Buffer Allocation
register.
- Add the Receive and Transmit Data FIFO registers.
 1.10.2.2  08-Jan-2005  jdc Fix pull up merge error.
Pointed out by Martin J. Laubach.
 1.10.2.1  07-Jan-2005  jdc Pull up revision 1.12 (requested by thorpej in ticket #897)

- Add some useful constants related to the Packet Buffer Allocation
register.
- Add the Receive and Transmit Data FIFO registers.
 1.13.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.4.1  29-Apr-2005  kent sync with -current
 1.14.6.4  21-Jan-2008  yamt sync with head
 1.14.6.3  03-Sep-2007  yamt sync with head.
 1.14.6.2  30-Dec-2006  yamt sync with head.
 1.14.6.1  21-Jun-2006  yamt sync with head.
 1.14.4.4  19-Nov-2007  bouyer Pull up following revision(s) via patch (requested by msaitoh in ticket #1863):
sys/dev/pci/if_wm.c 1.137-1.138,1.141,1.144-1.146
sys/dev/pci/if_wmreg.h 1.23
sys/dev/pci/pcidevs 1.893 via patch
share/man/man4/wm.4 1.18-1.19
Fix typo.
Fix EEPROM reload sequence.
Add ICH9 support.
Workaround for 82541 Errata 29 and 82547 Errata 28:
These devices have to reset the PHY before reset the MAC.
Reported and tested by salo.
 1.14.4.3  14-Oct-2007  riz Pull up following revision(s) (requested by bouyer in ticket #1770):
share/man/man4/wm.4: revision 1.17
sys/dev/pci/if_wmreg.h: revision 1.22
sys/dev/pci/if_wm.c: revision 1.139 via patch
sys/dev/pci/if_wm.c: revision 1.140 via patch
sys/dev/pci/pcidevs: patch
Add support for ICH8 (i82801H) LAN, from FreeBSD.
Should work on:
i82801H IFE (GT) LAN Controller
i82801H IFE (G) LAN Controller
i82801H (M_AMT) LAN Controller
i82801H (AMT) LAN Controller
i82801H LAN Controller
i82801H (IFE) LAN Controller
i82801H (M) LAN Controller
tested with: Intel i82801H (AMT) LAN Controller, rev. 2
Restore $NetBSD$ tag.
Note ICH8 LAN support.
 1.14.4.2  31-Mar-2007  bouyer pullup the following revisions (requested by msaitoh in ticket 1681):
sys/dev/pci/if_wm.c 1.104-1.105, 1.116-1.121,
1.127,1.133-1.134 via patch
sys/dev/pci/if_wmreg.h 1.17-1.20
sys/dev/pci/pcidevs patch
sys/dev/mii/igphy.c 1.11
sys/dev/mii/makphy.c 1.20, 1.23
sys/dev/mii/ikphy.c patch
sys/dev/mii/ikphyreg.h patch
sys/dev/mii/miidevs 1.68
sys/dev/mii/files.mii 1.39
sys/arch/i386/conf/GENERIC 1.788-1.789 via patch
sys/arch/i386/conf/GENERIC.MPACPI patch
sys/arch/i386/conf/GENERIC_LAPTOP 1.209 via patch
sys/arch/i386/conf/INSTALL 1.291 via patch
sys/arch/i386/conf/INSTALL_LAPTOP 1.104 via patch
sys/arch/i386/conf/XEN2_DOM0 1.13 via patch
share/man/man4/wm.4 1.14-1.16
Add support for many cards (include PCI-express based chips).
Many bug fixes about auto negotiations (PR#30078, PR#30490,
PR#30906, PR#33429 and PR#35386).
Fix media link issues with fiber-based card (PR#35797).
 1.14.4.1  28-Aug-2005  tron Pull up following revision(s) (requested by yamt in ticket #699):
sys/dev/pci/if_wmreg.h: revision 1.15
fix a typo(?) in an unused macro. (WRX_ST_ISXM -> WRX_ST_IXSM)
 1.16.14.1  19-Jun-2006  chap Sync with head.
 1.16.8.1  26-Jun-2006  yamt sync with head.
 1.16.4.1  09-Sep-2006  rpaulo sync with head
 1.19.8.2  10-Dec-2006  yamt sync with head.
 1.19.8.1  22-Oct-2006  yamt sync with head
 1.19.6.1  18-Nov-2006  ad Sync with head.
 1.21.10.1  11-Jul-2007  mjf Sync with head.
 1.21.8.2  09-Oct-2007  ad Sync with head.
 1.21.8.1  27-May-2007  ad Sync with head.
 1.21.4.1  07-May-2007  yamt sync with head.
 1.21.2.2  29-Aug-2007  liamjfoy Pull up following revision(s) (requested by masanobu in ticket #850):

sys/dev/pci/if_wm.c 1.137
sys/dev/pci/if_wm.c 1.138
sys/dev/pci/if_wm.c 1.141
sys/dev/pci/if_wm.c 1.144
sys/dev/pci/if_wmreg.h 1.23
sys/dev/pci/pcidevs 1.893
sys/dev/pci/pcidevs.h regen
sys/dev/pci/pcidevs_data.h regen
sys/dev/mii/igphy.c 1.12
sys/dev/mii/miidevs 1.72
sys/dev/mii/miidevs.h regen
sys/dev/mii/miidevs_data.h regen
share/man/man4/wm.4 1.18

Fix for 82541 and 82547's reset bug.
Modify wm_reset() to make some device stable.
Add ICH9 support to wm.
Add I82566 support to igphy.

Pulled done via patch.
 1.21.2.1  03-May-2007  snj branches: 1.21.2.1.2;
Pull up following revision(s) (requested by bouyer in ticket #598):
share/man/man4/wm.4: revision 1.17
sys/dev/pci/if_wmreg.h: revision 1.22
doc/CHANGES: revision 1.836
sys/dev/pci/if_wm.c: revision 1.139
sys/dev/pci/if_wm.c: revision 1.140
Add support for ICH8 (i82801H) LAN, from FreeBSD.
Should work on:
i82801H IFE (GT) LAN Controller
i82801H IFE (G) LAN Controller
i82801H (M_AMT) LAN Controller
i82801H (AMT) LAN Controller
i82801H LAN Controller
i82801H (IFE) LAN Controller
i82801H (M) LAN Controller
tested with: Intel i82801H (AMT) LAN Controller, rev. 2
Restore $NetBSD$ tag.
Note ICH8 LAN support.
Note ICH8 LAN support.
 1.21.2.1.2.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.22.8.2  09-Jan-2008  matt sync with HEAD
 1.22.8.1  06-Nov-2007  matt sync with HEAD
 1.22.6.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.22.2.1  03-Sep-2007  skrll Sync with HEAD.
 1.23.12.1  02-Jan-2008  bouyer Sync with HEAD
 1.23.8.1  26-Dec-2007  ad Sync with head.
 1.23.6.1  18-Feb-2008  mjf Sync with HEAD.
 1.24.26.1  19-Jul-2009  snj branches: 1.24.26.1.2;
Pull up following revision(s) (requested by msaitoh in ticket #862):
sys/dev/pci/if_wm.c: revisions 1.168, 1.170, and 1.173 via patch
sys/dev/pci/if_wmreg.h: revision 1.27
Fixes serious three bugs.
1) On i82563, the em driver says that the ready bit in the MDIC
register may be incorrectly set. Insert delay(200) like the em driver.
Fixes PR#41014
2) Add workaround for 82543GC. We need to force speed and duplex on
the MAC equal to what the PHY speed and duplex configuration is.
Fixes PR#36430.
3) Fix many problems and panic on TBI's cards (includes PR#32009).
 1.24.26.1.2.1  21-Apr-2010  matt sync to netbsd-5
 1.24.24.2  23-Jul-2009  jym Sync with HEAD.
 1.24.24.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.24.20.9  30-Apr-2015  snj Pull up following revision(s) (requested by msaitoh in ticket #1962):
sys/dev/pci/if_wm.c: revisions 1.259-1.266, 1.269, 1.271, 1.273-1.274, 1.277-1.278, 1.282, 1.284-1.285, 1.287, 1.290, 1.294, 1.297-1.298, 1.300-1.301, 1.304-1.307, 1.310, 1.312-1.314, 1.316 via patch
sys/dev/pci/if_wmreg.c: revisions 1.54-1.57, 1.59-1.60, 1.62, 1.64-1.66 via patch
sys/dev/pci/if_wmvar.c: revisions 1.17, 1.20-1.21 via patch
sys/dev/pci/pcidevs: revisions 1.1172, 1.1195, 1.1201 via patch
- Fix "MDIC write error" bug for 82574 and 82583. For those chips, the
semaphore must be released after chip reset. Found and tested by
Mark Davies.
- Fix BMC related bugs.
- Fix yet another NVM bank detect problem in wm(4). Use bank 0 if the detect
function failed. It's the same as FreeBSD. Observed and tested with
Asus P8P67 Deluxe motherboard and tested by jnemeth.
- Add support for I354 DH89xxCC and some new I218 devices.
- Fix definition of CTRL_GIO_M_DIS bit.
- Insert completion barrier between register write and delay().
- Bump max TX DMA size to avoid pathological condition with TSO. From dyoung.
- Fix semaphore related bugs.
- Call wm_set_pcie_completion_timeout() on I350, I354, I210 and I211, too.
Same as FreeBSD and OpenBSD.
- Drop PHPM_GO_LINK_D bit in WMREG_PHPM on some chips. From FreeBSD.
- Fix fiber link problem (PR#44776 and PR#30880).
- WM_T_82545 is not 1000base-SX but 1000base-LX. Same as FreeBSD.
- Set the WM_F_ATTACHED flag if wm_attach() finished succesfully and check
the flag in wm_detach(). It will avoid to panic in wm_detach().
Fixes PR#49102.
- It's not required to print "failed to detect NVM bank" with
aprint_error_dev(). Use DPRINTF(). Same as {Free,Open}BSD.
- Fix a bug that the offset of alt MAC address is wrongly calculated to 0
when alt MAC address function is really used. This bug does not appear
as real bug if the same MAC address is written in the default location
and alt MAC address's location.
- Initialize some hardware bits for 8257[1234], 82583, 80003, ICH* and PCH*.
Some of them are workaround code. From other *BSDs, Linux and documents.
- Fix a bug that wm_sgmii_writereg() function doesn't pass the "val" argument
to the I2CCMD register. Reported by Bernard Merindol in PR#49789.
- Delete 82580ER related code. It was from FreeBSD and was removed
in r203049.
- Remove extra debug message.
- Remove unused variable.
- Remove a duplicated error message.
- Cleanup comments.
- Fix debug message.
 1.24.20.8  07-Sep-2013  bouyer sys/dev/pci/if_wm.c 1.246-1.247, 1.249-1.258
sys/dev/pci/if_wmreg.h 1.51, 1.53
sys/dev/pci/if_wmvar.h 1.15-1.16
sys/dev/pci/pcidevs 1.1152-1.1153
sys/dev/pci/pcidevs.h regen
sys/dev/pci/pcidevs_data.h regen

Add I21[0178] support.
Fix a bug that wm_attach() may fail on some PCH2 or newer system.
wm_valid_nvm_bank_detect_ich8lan() misunderstood the NVM's bank
number. Fixes PR#47878.
Fix a bug that the check of reset complete fails on Intel 8 series
with "wm_lan_init_done: lan_init_done failed to complete" message.
The broken code was used for ICH8, 9... and PCH2.
The wm_linkintr_gmii() function is called from interrupt. That's
not tick, so call mii_pollstat() instead of mii_tick().
Add ECC support for the packet buffer. Only 82571 and I21[78] support
ECC.
Fix a bug that wrong semaphore is used in wm_gmii_hv_{read,write}reg.
Add comments, fix some comments, use macros and remove trailing
whitespaces.
[msaitoh, ticket #1867]
 1.24.20.7  19-Jun-2013  bouyer Pullup the following revisions via patch, requested by msaitoh in ticket #1850:
sys/dev/pci/if_wm.c 1.201, 1.203-1.204,
1.207-1.212, 1.215,
1.217-1.218, 1.220-1.223,
1.228, 1.232-245
sys/dev/pci/if_wmreg.h 1.40-1.45, 1.47-1.48
sys/dev/pci/if_wmvar.h 1.11-1.13
sys/dev/pci/pcidevs 1.1074, 1.1077, 1.1117
sys/dev/pci/pcidevs.h regen
sys/dev/pci/pcidevs_data.h regen
sys/dev/mii/igphyreg.h 1.6
sys/dev/mii/ihphy.c 1.1-1.2
sys/dev/mii/ihphyreg.h 1.1
sys/dev/mii/inbmphyreg.h 1.3
sys/dev/mii/files.mii 1.47 via patch
sys/dev/mii/miidevs 1.97 and 1.100
sys/dev/mii/miidevs.h regen
sys/dev/mii/miidevs_data.h regen
sys/arch/i386/conf/ALL 1.280
sys/arch/i386/conf/GENERIC 1.1001
sys/arch/i386/conf/INSTALL_FLOPPY 1.11
sys/arch/i386/conf/XEN2_DOM0 patch
sys/arch/amd64/conf/GENERIC 1.293
sys/arch/amd64/conf/XEN3_DOM0 1.61
share/man/man4/wm.4 1.21-1.24

Apply almost all fixes and improvements from netbsd-6 except for
the rev. 1.196's iqdrops' change.

- Add the detach code.
- Add code for WOL, ASF, IPMI and Intel AMT. WOL is disabled by default
- Add Yet another workaround for ICH8.
- 82576 is dual port, so check the FUNCID and increment the MAC address for
the 2nd port.
- Fix the names of 82577L[MC] LAN controllers (for mobile).
- Fix CTRL_EXT_SWDPIN() and CTRL_EXT_SWDPIO() macros. The bit order of the
SW definable pin is not 6543 but 3654!!!
- Rewrite the code to read MAC address from eeprom.
- Add 82580 support.
- 82571 quirk. Only 82571 shares port 0 of EEMNGCTL_CFGDONE.
- The document says that the TDH register must be set after
TCL.EN is set on 82575 and newer devices.
- Fix some register names. No functional change.
- Omit U+00AE "REGISTERED SIGN" in a product name due to its non-ASCII nature.
- Stop wm(4) from needlessly resetting when you add or delete a vlan(4).
- Fix MAC address check on 8257[156] and 80003 case. Some cards have non 0xffff
pointer but those don't use alternative MAC address in reality. So we check
whether the broadcast bit is set or not like Intel's e1000 driver.
Fixes PR kern/44072 reported by Jean-Yves Moulin.
- Add PCH2(and 82579) support. Fixes PR#46487
- Add yet another 82567V support.
- Add ICH10+HANKSVILL support.
- Add support Intel I350 Ethernet.
- Make vlan and all ip/ip6 checksum offload work for the I350.
- Fix compile error with WM_DEBUG.
- Fix a bug that PHY isn't set to low-power mode on PCH and PCH2.
- Add WM_DEBUG_NVM. If WM_DEBUG_NVM is enabled, dump the FLASH ROM data.
- Skip 64bit BAR correctly.
- Fix RAL_TABSIZE for ICH8, 82576, 82580 and I350.
- Use 82580(and I350) specific PHY read/write functions. Fixes PR#47542.
- Style fix. Fix typo in comment. Fix comments. Add comments.
 1.24.20.6  05-Jan-2012  sborrill Pull up the following revisions(s) (requested by dyoung in ticket #1703):
sys/dev/pci/if_wmreg.h: revision 1.46

Mark all of the wm(4) Rx descriptor fields 'volatile' so that the compiler
will not re-order accesses. Some versions of GCC (such as one in NetBSD
5.x) definitely do re-order reads from these fields if they're not
marked volatile.
 1.24.20.5  19-Nov-2010  riz Pull up revisions (requested by msaitoh in ticket #1358):
sys/dev/pci/if_wm.c 1.196-1.199,1.202,1.205
sys/dev/pci/if_wmvar.h 1.9
sys/dev/pci/if_wmreg.h 1.36-1.39
sys/dev/pci/pcireg.h 1.61-1.64
sys/dev/pci/pcidevs 1.1023
sys/dev/pci/pcidevs.h regen
sys/dev/pci/pcidevs_data.h regen
mii/igphy.c 1.21
mii/igphyvar.h 1.1
mii/inbmphyreg.h 1.2

- Count Receive error, CRC error, Alignment error, Symbol error, Sequence
error, Carrier extension error and Receive length error into ierror.
Fixes PR#30349 reported by UMEZAWA Takeshi.
- Add support for 82575, 82576 and 82580(ER).
- Apply the patch for 82575 from Wolfgang Stukenbrock (PR#42422). We use
only one RX ring and with the legacy mode.
- Add support for 82576.
- Partial support for 82580.
- Partial support for the serdes systems.
- Add two workarounds for ICH8 with igp3.
- Workaround for 82566 Kumeran PCS lock loss.
- WOL from S5 stops working.
- (pcireg.h) Add PCIe config register definitions.
- Note that the changes to count Missed packet (rx fifo overflow) and Receive
no buffers (rx ring full) into iqdrops in rev. 1.196 of if_wm.c is not
pulled up.
 1.24.20.4  27-Jan-2010  sborrill Pull up the following revisions(s) (requested by msaitoh in ticket #1277):
sys/dev/pci/if_wm.c 1.184-1.192, 1.194
sys/dev/pci/if_wmreg.h 1.29-1.35
sys/dev/pci/if_wmvar.h 1.5-1.8
sys/dev/pci/pcidevs 1.1006,1.1009-1.1010, 1.1012-1.1013 via patch
sys/dev/pci/pcidevs.h regen
sys/dev/pci/pcidevs_data.h regen
sys/dev/mii/igphyreg.h 1.5
sys/dev/mii/inbmphyreg.h 1.1

- Add support for i82583V.
- Add some ICH9 and ICH10 devices.
- Add support for PCH.
- Fix the bug that ICH9 can't found a PHY. Fixes PR#42237
- Fix an incorrect test for WM_F_EEPROM_INVALID since rev. 1.183. Some old
chips don't set EECD_EE_PRES.
- Fix a bug that both WM_F_EEPROM_SPI and WM_F_EEPROM_FLASH are set.
- Add a missing decrement for a timeout reported by Wolfgang Stukenbrock
in PR#42422.
- PBA setting for i82574 is not 12K but 20K.
- Enable checking the management mode on 82574.
- Fix the length of the delay() in wm_gmii_reset(). It fixed the problem that
sometimes the driver misunderstood PHYs in mii_attach(). It was reported
by MATSUI Yoshihiro. We observed it on ICH9.
- Fix the checking of jumbo frame function
- Remove the extra macro definition for the offset 0x1a in EEPROM.
- Add missing break in wm_reset()...
- Fix the offset of WMREG_PBS...
- Make wm_reset() and wm_gmii_reset() close to e1000 driver.
At least, this change make wm_attach() stable on ICH9.
- Reset GMII interface after wm_reset() in wm_init().
- Rework for assigning mii_{read,write}reg(). Use PCI product ID to identify
the PHY.
- Add code about LPLU(Low Power Link Up) function. It seems that we have to
do the same work for ICH9.
- Fixes the rx stall problem on 82578 by MANY workaround code. We need more
work for 82577.
 1.24.20.3  23-Dec-2009  sborrill Pull up the following revisions(s) (requested by msaitoh in ticket #1203):
sys/dev/pci/if_wm.c: 1.176-1.179, 1.181-1.183
sys/dev/pci/if_wmreg.h: 1.28
sys/dev/pci/if_wmvar.h: 1.1-1.4
sys/dev/mii/igphy.c: 1.18-1.20 via patch

Many bugfixes:
- Some fixes for i80003 and ICH{8,9,10} from e1000 driver and document:
- Add setting for KABGTXD register for ICH{8,9,10}.
- ICH9 and ICH10 has no FCAL, FCAH and FCT like ICH8.
- Add special setting for FCTTV and TCTL_EXT register for i80003
- The special setting for TIPG is only for i80003.
- Some of kumeran settings are only for i80003's bugs.
- Add some ICH10 fixes.
- Fix the bug that another lock mechanism is used to access Kumeran
registers on i80003 and ICHs.
- Fix yet another i80003 ONLY workaround. The code to modifing TIPG
register is only for i80003.
- Set the Re-Transmit on Late Collision(RTLC) flag for all devices.
- Fix a typo in a printf message.
- If the difference bettween last flag and new flag is only IFF_PROMISC
or IFF_ALLMULTI, set multicast filter only to prevent link down.
Tested by Mark Davies and me. Fixes PR#29126 for wm.
- Cleanup interrupt establish error messages. Do not mix
aprint_error/aprint_normal/printf calls for a single line.
- Fix igphy's 82566 support.
- Patch for the DSP code is only for 8254[17] and we have to apply
the different patches between rev. 1 and rev. 2.
- The workaround for analog fuse is only for 82547 rev. 1.
- The workaround for smartspeed is only for 8254[17]
- Sync with Intel's original em driver:
- Check PCI-X mode as e1000 driver.
- Add dspcode for igp3 and use it when the EEPROM isn't available.
- Add some delays.
- Stop the PHY transmitter before patching the DSP code and
restart it after writing.
- Save and restore register 0x2f5b.
 1.24.20.2  21-May-2009  snj Pull up following revision(s) (requested by bouyer in ticket #711):
sys/dev/pci/pcidevs: revisions 1.975, 1.981, 1.982 via patch
sys/dev/pci/if_wm.c: revisions 1.164, 1.167, 1.173, 1.174 via patch
sys/dev/pci/if_wmreg.h: revisions 1.25, 1.27 via patch
Add Intel 82567LM_3 ethernet
--
Add i82567LM-3
--
add i82567LF-3 LAN Controller
--
add an entry for 82567LF-3.
fix the register access for ICH10DO.
--
Fix about TBI mode. This fix doesn't influence MII mode.
--
- Fix panic in mediachange.
- Fix SWDPIN(1)'s polarity on some chips.
- Fix flow control stuff (includes PR#32009).
- Stop RXCFG storm. It ocours easily.
- And more fix about autonego.
--
add 82801J_D_BM_LF (ICH10)
--
Reload sc_ctrl in wm_reset().
Add an ICH10 entry.
Remove some obsolete comments.
 1.24.20.1  03-May-2009  snj Pull up following revision(s) (requested by spz in ticket #621):
sys/dev/pci/if_wm.c: revisions 1.168, 1.169 via patch
sys/dev/pci/if_wmreg.h: revision 1.26 via patch
On i82563, the em driver says that the ready bit in the MDIC register may be
incorrectly set. Insert delay(200) like the em driver.
--
Examine the management mode and mark DRV_LOAD (for ICH{8,9,10},80003,
8257{1,2,3,4}).
Add some error's printf().
Make the bank detect routine into the function.
 1.24.18.1  28-Apr-2009  skrll Sync with HEAD.
 1.24.10.4  11-Aug-2010  yamt sync with head.
 1.24.10.3  11-Mar-2010  yamt sync with head
 1.24.10.2  18-Jul-2009  yamt sync with head.
 1.24.10.1  04-May-2009  yamt sync with head.
 1.36.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.36.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.40.2.3  31-May-2011  rmind sync with head
 1.40.2.2  05-Mar-2011  rmind sync with head
 1.40.2.1  03-Jul-2010  rmind sync with head
 1.44.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.45.8.2  02-Jun-2012  mrg sync to latest -current.
 1.45.8.1  18-Feb-2012  mrg merge to -current.
 1.45.4.3  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.45.4.2  30-Oct-2012  yamt sync with head
 1.45.4.1  17-Apr-2012  yamt sync with head
 1.46.2.9  06-May-2016  snj Pull up following revision(s) (requested by msaitoh in ticket #1366):
sys/dev/pci/if_wm.c: 1.281, 1.318, 1.320, 1.324-1.332, 1.334, 1.336, 1.343-1.344, 1.347-1.348, 1.350, 1.376-1.382, 1.386-1.387, 1.389 via patch
sys/dev/pci/if_wmreg.h: 1.68-1.70, 1.73-1.77, 1.79-1.80, 1.82, 1.86-1.88 via patch
sys/dev/pci/if_wmvar.h: 1.22-1.23, 1.25-1.30 via patch
sys/dev/mii/igphy.c: 1.25
sys/dev/mii/ukphy.c: 1.48
Sync wm(4) as of if_wm.c rev 1.389 except SERDES, MSI/MSI-X, multiqueue
and NET_MPSAFE:
- Set ICH9 and ICH10's PBA size to 14K if the RX buffer size is more
than 4096. Almost the same as other OSes.
- For 82576 and newer devices, the PBA register is deleted. Don't write
PBA for those chips. Also change the calculation of RX packet buffer
size in new way.
- Print NVM image version and option ROM version.
- Add workaround for I210 Errata 25 and I211 Errata 10 (PLL bug). This
workaround is required if the NVM image version < 3.25.
- Fix a bug that wm_detach() didn't unmap the FHASH's area. Now
"drvctl -d wm0" -> "drvctl -r pci0" works on ICH* and PCH*.
- Add workaround for 82574 Errata 25 and 82583 Errata 12 "Dropped RX
packets" and for 82573 (unknown). Set GCR_L1_ACT_WITHOUT_L0S_RX bit.
The NVM Image version 2.1.4 and newer have this workaround.
- Check PHY type correctly. This change is required to use igphy(4)
device correctly.
- Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH*
too.
- Call wm_get_hw_control() correctly. This change fixes a bug that some
AMT based systems doesn't linkup at 1000BaseT. The problem was
observed on HP Compaq dc7700. A lot of fixes have been done for wm(4)
and igphy(4), so now PR#44893 should be fixed.
- Call wm_get_wakeup(sc) before checking WM_F_HAS_AMT. It's required to
check the existence of AMT correctly.
- Fix a problem that wm_gate_hw_phy_config_ich8lan() isn't called in
wm_reset() on PCH2.
- Clear WMREG_WUC in wm_reset() if the chip >= 82544. This might fix
the behavior on suspend/resume.
- Fix logic of wm_check_reset_block() on ICH* and PCH*. This change
might fix a problem that PHY's read/write functions can't get
semaphore.
- On ICH8, call wm_gig_downshift_workaround_ich8lan() when link changed
down.
- Drop PHY_CTRL_GBE_DIS explicitly in wm_lplu_d0_disable() in case BIOS
sets this bit.
- Fix two bugs in wm_kmrn_lock_loss_workaround_ich8lan(). Now the
function checks the status correctly but it causes linkdown up to 10
times, so it's disabled for the time being.
- PR/50527: David Binderman: Fix impossible code. Odd offsets need
special treatment.
- Fix RAL table's size of PCH2 and PCH_LPT.
- PCH_LPT (and newer device) is required to check FWSM_WLOCK_MAC bit to
determine the range of the RAL.
- Use sc->sc_itr instead of hard-coded number.
- Rename wm_tbi_check_link() to wm_tbi_tick() because this function
acts as mii_tick().
- ACK Accelerate Disable in the RFCTL register is not bit 13 but 12.
No binary change because this definition has not used yet.
- Add ACK data Disable bit's definition (not used yet).
- PHY_CTRL_GBE_DIS is not bit 4 but bit 6. This change has no any
effect by default because WM_WOL is not defined yet and
m_kmrn_lock_loss_workaround_ich8lan() is broken.
- Fix wm_check_mng_mode_ich8lan(). This function is used only when
WM_WOL is defined and it's disabled by default.
- Rename wm_check_reset_block() to wm_phy_resetisblocked() and make it
returns bool. No functional change.
- Reorder function definitions and macro definitions. No functional
change.
- Fix comment. Add comment. Update comment.
- KNF.
 1.46.2.8  16-Apr-2015  snj Pull up following revision(s) (requested by msaitoh in ticket #1277):
sys/dev/pci/if_wm.c: revision 1.312 via patch
sys/dev/pci/if_wmreg.h: revision 1.66 via patch
- Initialize some hardware bits for 8257[1234], 82583, 80003, ICH* and PCH*.
Some of them are workaround code. From other *BSDs, Linux and documents.
- Add comment.
- Fix typo in comment.
 1.46.2.7  04-Dec-2014  snj Pull up following revision(s) (requested by msaitoh in ticket #1203):
sys/dev/pci/if_wm.c: revisions 1.271, 1.273-1.274, 1.277-1.278,
1.280, 1.282, 1.284-1.285, 1.287,
1.293-1.294, 1.297-1.298,
1.300-1.301, 1.305-1.307 via patch
sys/dev/pci/if_wmreg.h: revisions 1.57-1.62, 1.64-1.65 via patch
sys/dev/pci/if_wmvar.h: revisions 1.19, 1.21 via patch
- Acquire SW semaphore in wm_get_swsm_semaphore().
- Fix some bugs realted to semaphore. This change fixes a problem which
was exposed in if_wm.c rev. 1.271. Tested by riastradh@.
- Clear the SMBI bit in SWSM register before accessing NVM and PHY in
wm_attach(). Same as FreeBSD.
- Fix a bug that 82573 doesn't put the hardware semaphore. Same as
FreeBSD r256200.
- Call wm_set_pcie_completion_timeout() on I350, I354, I210 and I211, too.
Same as FreeBSD and OpenBSD.
- Drop PHPM_GO_LINK_D bit in WMREG_PHPM on some chips. From FreeBSD.
- Fix fiber link problem (PR#44776 and PR#30880). Tested with 82543GC, 82544EI,
82545EM, 82546GB 82571EB and 82572EI fiber cards.
- Don't use the RXCFG interrupt. It's not required and the interrupt is very
heavy (a lot of interrupts). Same as {Free,Open}BSD.
- Modify wm_tbi_mediachange() to be close to em_setup_fiber_serdes_link()
of {Free,Open}BSD. At least, don't forget to set duplex setting.
- WM_T_82545 is not 1000base-SX but 1000base-LX. Same as FreeBSD.
- Don't check SWSM_SMBI bit if WM_F_LOCK_SWSM isn't set. Fix a problem when
using vmware with e1000"e". With e1000e which is regarded as 82574L,
wm_gmii_init() fails with "could not acquire SWSM SMBI" message without
this change. This problem doesn't occur with real 82574L card.
- Fix a bug that wm_get_swsm_semaphore() timed out when attaching device on
some machines.
- Calculate NVM word size correctly.
- Determine timeout value based on the NVM word size.
- It's not required to print "failed to detect NVM bank" message.
Only print while debugging. Same as {Free,Open}BSD.
- Add some new I218 devices.
- Delete 82580ER related code. It was from FreeBSD and was removed in r203049.
- Fix a bug that the offset of alt MAC address is wrongly calculated to 0
when alt MAC address function is really used. This bug does not appear
as real bug if the same MAC address is written in the default location
and alt MAC address's location.
- Move some NVM related macros from if_wm.c to if_wmreg.h.
- Sort definitions in if_wmreg.h
- move NVM related values to the bottom.
- sort in register's address' order.
- Simplify wm_read_mac_addr().
- Fix debug message.
- Add missing prototypes.
- Rename some functions for consistency and clarify.
- Rename some macros for consistency.
- Remove a duplicated error message.
- Fix typo in comment.
- Cleanup comments.
- KNF.
 1.46.2.6  09-Nov-2014  martin Pullup the following revisions, requested by msaitoh in ticket #1188:
sys/dev/pci/pcidevs 1.1172
sys/dev/pci/if_wm.c 1.263-1.266 via patch
sys/dev/pci/if_wmreg.h 1.55-1.56
sys/dev/pci/if_wmvar.h 1.17
share/man/man4/wm.4 1.26-1.27 and 1.29 via patch

- Add I354 support.
- Insert completion barrier between register write and delay().
- Fix the definition of CTRL_GIO_M_DIS. This bit is not bit 3 but bit 2.
- Cleanup
 1.46.2.5  29-Jul-2013  jdc Pull up revisions:
src/sys/dev/pci/if_wm.c revisions 1.259,1.260,1.261,1.262
src/sys/dev/pci/if_wmreg.h revision 1.54
(requested by msaitoh in ticket #918).

Fix "MDIC write error" bug for 82574 and 82583. For those chips, the semaphore
must be released after chip reset. Found and tested by Mark Davies.

Sync the wm_enable_mng_pass_thru() function with FreeBSD. Don't check
MANC_EN_MAC_ADDR_FILTER bit. Add 82574 and 82583 specific check. This
modification may change the setting of WM_F_HAS_MANAGE flag on some machines.

Sync the wm_release_manageablilty() fucntion with FreeBSD. Set MANC_ARP_EN.
This change enables HW ARP function when entering suspend.

When the chip is 82580(ER) or I350, set WM_F_ASF_FIRMWARE_PRES flag and
check for the WM_F_ARC_SUBSYS_VALID flag. Same as FreeBSD.

Move the location of wm_check_mng_mode() and wm_get_wakeup() in wm_attach().
Those functions access EEPROM, so they have to call after identifying EEPROM
access type. This modification may change the behavior of BMC(IPMI).

Fix yet another NVM bank detect problem in wm(4). Use bank 0 if the detect
function failed. It's the same as FreeBSD. Observed and tested with Asus P8P67
Deluxe motherboard and tested by jnemeth.
 1.46.2.4  14-Jul-2013  riz Apply changes (requested by msaitoh in ticket #907):

sys/dev/pci/if_wm.c 1.238, 1.244-1.247, 1.249-1.258
sys/dev/pci/if_wmreg.h 1.50-1.51, 1.53
sys/dev/pci/if_wmvar.h 1.15-1.16

Various fixes to wm(4):
Add I21[0178] support.
Fix a bug that wm_attach() may fail on some PCH2 or newer system.
wm_valid_nvm_bank_detect_ich8lan() misunderstood the NVM's bank
number. Fixes PR#47878.
Fix a bug that the check of reset complete fails on Intel 8 series
with "wm_lan_init_done: lan_init_done failed to complete" message.
The broken code was used for ICH8, 9... and PCH2.
The wm_linkintr_gmii() function is called from interrupt. That's
not tick, so call mii_pollstat() instead of mii_tick().
Add ECC support for the packet buffer. Only 82571 and I21[78] support
ECC.
Fix a bug that wrong semaphore is used in wm_gmii_hv_{read,write}reg.
Change style, add comments, fix some comments, use macros and
remove trailing whitespaces.
[msaitoh, ticket #907]
 1.46.2.3  18-Feb-2013  riz Pull up following revision(s) (requested by msaitoh in ticket #824):
sys/dev/pci/if_wm.c: revision 1.240
sys/dev/pci/if_wm.c: revision 1.241
sys/dev/pci/if_wm.c: revision 1.242
sys/dev/pci/if_wmreg.h: revision 1.49
- Add WM_DEBUG_NVM.
- If WM_DEBUG_NVM is enabled, dump the FLASH ROM data.
Skip 64bit BAR correctly. I don't know if this bug causes a real problem.
Fix RAL_TABSIZE for ICH8, 82576, 82580 and I350.
 1.46.2.2  03-Sep-2012  riz Pull up following revision(s) (requested by bouyer in ticket #534):
sys/dev/pci/if_wmreg.h: revision 1.48
sys/dev/pci/if_wm.c: revision 1.232
sys/dev/pci/if_wm.c: revision 1.233
sys/dev/pci/if_wm.c: revision 1.234
Make vlan and all ip/ip6 checksum offload work for the I350.
On newer devices, when using the legacy TX descriptors, vlan-related flags
that were set on the last descriptor of a packet have to be set on the
first one.
For tso/checksum offloads, a new "advanced" descriptor format has to be
used.
Change wcd_txdescs to a union defining all types of descriptors (they
are all 16-bytes wide).
Define a new tx function wm_nq_start(), which handle newer devices.
There is some code duplication with wm_start(), but adding support to
the existing wm_start() would make it a if () {} else {} maze. This also
allows to get rid of some workaround for older chips that are not needed
here.
Use wm_nq_start() instead of wm_start() for the I350 (this should probably
be for all WM_F_NEWQUEUE devices, but I have no hardware but the I350 to
test). Call ifp->if_start() instead of wm_start() where is matters.
Tested on a I350, and a i80003 (which use the old format), both with and
without vlans, with and without checksum offloads.
Enable VLAN hardware tagging on all chips that have the new queue mechanism.
Tested with 82575{EB,GB}, 82576, 82580, I350 and ICH9.
Shut up gcc about some uninitialized variables.
 1.46.2.1  28-Jun-2012  riz branches: 1.46.2.1.2;
Pull up following revision(s) (requested by msaitoh in ticket #362):
sys/dev/pci/if_wm.c 1.228
sys/dev/pci/if_wmreg.h 1.47
sys/dev/pci/if_wmvar.h 1.13
sys/dev/pci/pcidevs 1.1117
sys/dev/pci/pcidevs.h regen
sys/dev/pci/pcidevs_data.h regen
share/man/man4/wm.4 1.22-1.25

Add support for Intel I350 Ethernet.
Update document.
 1.46.2.1.2.1  01-Nov-2012  matt sync with netbsd-6-0-RELEASE.
 1.48.2.4  03-Dec-2017  jdolecek update from HEAD
 1.48.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.48.2.2  23-Jun-2013  tls resync from head
 1.48.2.1  25-Feb-2013  tls resync with head
 1.54.2.1  18-May-2014  rmind sync with head
 1.55.2.1  10-Aug-2014  tls Rebase.
 1.60.2.10  09-Nov-2018  sborrill Pull up the following revisions(s) (requested by msaitoh in ticket #1648):
sys/dev/mii/inbmphyreg.h 1.11
sys/dev/pci/if_wm.c 1.586-1.588, 1.590-1.596 via patch
sys/dev/pci/if_wmreg.h 1.108

- rename tu event counter to txunderrun.
- Try m_defrag() to reduce the number of DMA segment if bus_dmamap_load_mbuf()
returned EFBIG. When m_defrag() is called, txqNNdefrag event counter is
incremented. If the 2nd try of bus_dmamap_load_mbuf() failed, txqNNtoomanyseg
event counter is incremented.
- Reduce the max number of DMA segments from 256 to 64 (it's the same value
as other BSD's (EM_MAX_SCATTER) and more than before if_wm.c rev. 1.75's
value (40)) because we do m_defrag() now.
- 82574 and newer document says the status field has neither EC
(Excessive Collision) bit nor LC (Late Collision) bit (reserved), so
don't check the bit.
- Add workaround for DMA hang problem which result in TX device timeout
on PCH_LPT with I218. Same as FreeBSD and Linux. This workaround is
only for device ID 0x155a, 0x15a2, 0x1559 and 0x15a3.
- Fix a PCH2 specific bug that wrong PHY register value can be read
when boot. Same as FreeBSD and Linux.
- After writing MDIC register, don't read quickly the same register but
do delay(50). Same as other OSes.
- Add missing wm_gate_hw_phy_config_ich8lan(false) in
wm_phy_post_reset() on PCH2. wm_gate_hw_phy_config_ich8lan(true) is
called in wm_reset(), so wm_gate_hw_phy_config_ich8lan(false) should
be called after reset in wm_phy_post_reset().
- On PCH2, set the phy config counter to 50msec after (PHY) reset.
- KNF & Use macro.
 1.60.2.9  11-Aug-2018  martin Pull up the following, requested by msaitoh in ticket #1628:

share/man/man4/wm.4 1.40 via patch
sys/dev/mii/ihphyreg.h 1.2
sys/dev/mii/inbmphyreg.h 1.10
sys/dev/pci/if_wm.c 1.504, 1.506, 1.510-1.535, 1.539-1.540, 1.546, 1.548, 1.551-1.552, 1.558, 1.565-1.573, 1.575, 1.579, 1.582, 1.584 via patch
sys/dev/pci/if_wmreg.h 1.99-1.103, 1.106-1.107 via patch
sys/dev/pci/if_wmvar.h 1.34-1.39 via patch
sys/dev/pci/pcidevs 1.1327 via patch
sys/dev/pci/pcidevs.h regen
sys/dev/pci/pcidevs_data.h regen
sys/dev/pci/pcireg.h patch

Sync wm(4) up to 2018/08/08 except MSI/MSI-X and NET_MPSAFE:
- remove extra "+"
- Fix a bug that non-GMII devices don't send a routing message when
the link status is changed.
- Set WMREG_KABGTXD not in wm_init_locked() but in wm_reset(). Same as
other OSes.
- If a interrupt is a spurious interrupt, don't print debug message.
- Don't print the Image Unique ID if an NVM is iNVM (i210 and I211).
- Print sc_flags with snprintb().
- Fix a bug that a RAL was written at incorrect address when the index
number is more than 16 on 82544 and newer.
- The layout of RAL on PCH* are different from others. Fix it.
- Flush every MTA write. Same as Linux.
- Move the location of calling wm_set_filter. Same as some other OSes.
- Add CSR_WRITE_FLUSH() after writing WMREG_CTRL in
wm_gmii_mediachange().
- Add missing "else" in wm_nvm_release().
- Make new wm_phy_post_reset() and use this function at all location
after resetting phy.
- Move the location of calling wm_get_hw_control. Same as Linux.
- Add I219 specific wokaround for legacy interrupt. From OpenBSD.
- Move the location of calling wm_lplu_d0_disable().
- Fix latency calculation in wm_platform_pm_pch_lpt().
- Set OBFF water mark and enable OBFF on PCH_LPT and newer.
- Disable D0 LPLU on 8257[12356], 82580, I350 and I21[01], too. Before
this commit, above devices and non-PCIe devices accessed wrong
register.
- Use device_printf() instead of aprint_error_dev() for PHY read/write
functions because those are used not only in device attach.
- Fix a bug that wm_gmii_i82544_{read,write}reg() didn't take care of
page select. PHY access from igphy() automatically did it, but
accessing from wm(4) for wrokaround didn't work correctly. This
change affects 8254[17], 8257[12] ICH8, ICH9 and ICH10.
- Call wm_kmrn_lock_loss_workaround_ich8lan() before any PHY access in
wm_linkintr_gmii().
- Register access in wm_kmrn_lock_loss_workaround_ich8lan() now works
correctly. Enable this function.
- Configure the LCD with the extended configuration region in NVM if
it's required.
- If TX is not required to flush, RX is also not required to flush
in wm_flush_desc_rings(). Same as other OSes.
- Remove wrong semaphore access in wm_nvm_{read,write}_{ich8,spt} to
prevent hangup. A semaphore is get/put in wm_nvm_{read,write}.
- Move some initialization stuff in wm_attach() before wm_reset(). Some
flags and callback function are required to set correctly before
wm_reset() because wm_reset() and some helper functions refer them.
- Add wm_write_smbus_addr() to set SMBus address by software.
- Modify wm_gmii_hv_{read,write}reg_locked() to make them access
HV_SMB_ADDR correctly.
- Use new nvm.{acquire,release}() for semaphore.
- Our MII readreg/writereg API has not way to detect an error.
kmrn_{read,write}reg() are not used for MII API, so it's not required
for these functions to use the same API. So,
- Change return value as error code.
- Change register value from int to uint16_t.
- read: pass pointer for uint16_t as an argument.
- Check return value on caller side.
- Check whether it's required to use MDIC workaround for 80003 or not
in wm_reset(). If the workaround isn't required, don't use the
workaround code in wm_gmii_i80003_{read,write}reg.
- Add WM_F_WA_I210_CLSEM flag for a workaround. FreeBSD/Linux drivers
say "In rare circumstances, the SW semaphore may already be held
unintentionally on I21[01]". PXE boot is one of the case.
- Qemu's e1000e emulation (82574L)'s SPI has only 64 words. I've never
seen on real 82574 hardware with such small SPI ROM. Check
sc->sc_nvm_wordsize before accessing higher address words to prevent
timeout.
- Check some wm_nvm_read()'s return vale.
- Print NVM offset and word count when EERD polling failed.
- On I219, drop TARC0 bit 28 for DMA hang workaround (from Linux).
- 82583 supports jumbo frame. Fixes PR#52773 reported by
Shinichi Doyashiki.
- Fix typo in comment. Reported by Shinichi Doyashiki in PR#52885.
- Add ASPM workaround for 8257[1234] and 82583 to prevent device
timeout or hangup. Fixes PR#52818 reported by Shinichi Doyashiki.
- CID-1427779: Fix uninitialized variables.
- Fix a bug that wm_pll_workaround_i210() is not called when
a) Chip is I211 or b) Chip is I210 and it uses iNVM (not FLASH).
- Do wm_reset_mdicnfg_82580() on 82580 only.
- Fix FLASH access on PCH_SPT and newer. Their FLASH access should be
done by 32bit. Especially for ICH_FLASH_HSFCTL register, it's located
at 0x0006, so it must be accessed via ICH_FLASH_HSFSTS(0x0004) and
use shift or mask.
- Make wm_nvm_valid_bank_detect_ich8lan() the same as other OSes.
- If the extended configuration size in the EXTCNFSIZE register is 0,
don't continue in wm_init_lcd_from_nvm().
- Add PCH_CNP support (I219 with Intel 300 series chipset).
- Enable I219 support.
- I354 uses an external PHY, so don't use wm_set_eee_i350().
- Fix a bug that the link can't detect in link interrupt function for
non-SERDES fiber.
- Fix a bug that 82542 misunderstand fiber's signal detection.
- Add debug printf()s.
- Update comment.
- Rename functions and variables.
- Add diagnostic code.
- Sort registers.
- Lowercase hexadecimal values.
- KNF.
 1.60.2.8  09-Mar-2017  snj Pull up following revision(s) (requested by msaitoh in ticket #1372):
sys/dev/pci/if_wm.c: revisions 1.462, 1.464-1.465 1.474 via patch
sys/dev/pci/if_wmreg.h: revision 1.97
sys/dev/pci/if_wmvar.h: revision 1.33
- Set IPV6EXDIS bit in RFCTL register because of an Errata on 82575 and
newer devices.
- Linux and FreeBSD defines 0x10f5 as E1000_DEV_ID_ICH9_IGP_M_AMT. In
reality, This is not IGP but BM. Add new case to identify PHY type
device. Fixes PR#51924 reported byJarle Greipsland.
- Use new wm_gmii_setup_phytype() function to setup sc_phytype and
mii_{read|write}reg. This change improves detection of PHY type.
- Fix typo in comment.
 1.60.2.7  18-Dec-2016  snj Pull up following revision(s) (requested by msaitoh in ticket #1327):
sys/dev/pci/if_wm.c: revision 1.457
sys/dev/pci/if_wmreg.h: revision 1.94
- Change to use 2500Base-KX correctly on C2000(I354). It worked, but the
output of ifconfig and if_baudrate was not good. Tested by nils@:
- The STATUS_TBIMODE bit in the STATUS register is deleted since 82575,
so check for 82575 and newer first and then check for old devices.
- Check the 2P5_SKU and 2P5_SKU_OVER bit for KX.
- Set IFM_2500_SX instead of IFM_1000_SX for 2.5G.
- Check SERDES's speed directly from the PCS layer (PCS_LSTS register) for old
devices.
- Style fix.
 1.60.2.6  12-Dec-2016  snj Pull up following revision(s) (requested by msaitoh in ticket #1302):
sys/dev/mii/igphyreg.h: revisions 1.7-1.10
sys/dev/mii/ikphyreg.h: revisions 1.3
sys/dev/mii/inbmphyreg.h: revisions 1.4-1.9
sys/dev/mii/mii.h: revisions 1.19-1.20
sys/dev/pci/if_wm.c: revisions 1.390, 1.392-1.395, 1.397, 1.419-1.425, 1.427-1.428, 1.430-1.435, 1.437-1.453 via patch
sys/dev/pci/if_wmreg.: revisions 1.89-1.93 via patch
sys/dev/pci/if_wmvar.h: revisions 1.31-1.32
Update wm(4) up to if_wm.c rev. 1.453 except MSI/MSI-X, multiqueue and
NET_MPSAFE:
- Add I219 support. It's not stable so it's disabled by default.
- wm_gate_hw_phy_config_ich8lan() is for younger than PCH2.
- Drop the host wakeup bit after resetting PHY on PCH and newer
devices.
- Increase delay while toggling LANPHYPC
- Move call of wm_reset() in wm_attach() after setting PHY and NVM
related flags because those flags are used in wm_reset().
- Use mutex for NVM access on ICH8 and newer devices. Same as FreeBSD.
- Rewrite PHY related lock stuff. Almost the same as FreeBSD.
This change will fix a bug that PHY read/write fail on some cases.
- Increase delay in wm_phy_resetisblocked(). Same as FreeBSD.
- Use semaphore in wm_hv_phy_workaround_ich8lan() and
wm_k1_gig_workaround_hv()
- Use wm_gii_mdic_readreg/writereg() in wm_access_phy_wakeup_reg_bm()
because these functions are called with taking lock.
- 82567V_3 is BME1000_E_2(bm). Tested with Advantech AIMB-212 1st
Ethernet port.
- Use wm_gmii_82544_{read,write}reg() on non-82567 ICH8, 9 and 10.
- Remove an 82578 workaround which was for PCH rev < 3. FreeBSD
removed this workaround in r228386.
- Add an 82578 workaround which is for PHY rev < 2. From FreeBSD and
Linux.
- Fix wm(4) input drop packet counter. WMREG_RNBC is incremented when
there is no available buffers in host memory. However, ethernet
controller can receive packets in such case if there is space in
phy's FIFO. That is, ethernet controller drops packet only if there
is no available buffers *and* there is no space in phy's FIFO. So,
the number of dropped packets should be added WMREG_MPC only.
- Use MII_ADDRMASK.
- Define WMPHY_I217, WMPHY_VF and WMPHY_210.
- Use BME1000_PHY_PAGE_SELECT in wm_gmii_bm_{read,write}reg(). This
change has no effect because GG82563_PHY_PAGE_SELECT and
BME1000_PHY_PAGE_SELECT have the same value.
- Fix PHY access on 82567(ICH8 or ICH10), 82574 and 82583:
- Use wm_gmii_bm_{read,write}reg() on 82574 and 82573.
- Issue page select correctly on BM PHYs.
- Fix workaround which did dummy read BM_WUC register. This code was
changed to drop BM_WUC_HOST_WU_BIT of BM_PROT_GEN_CFG register in
FreeBSD r228386. The code was added rev. 1.149, but the location was
not the best.
- wm_gmii_hv_{read/write}reg*(): USE PHY address 1 for some special
registers.
- Add check code for an 82578 workaround. Not completed yet.
- wm_release_hw_control(): Remove extra line. No any effect.
- Add "10/100" into non-gigabit devices' name.
- Call wm_enable_wakeup() in wm_detach() and wm_suspend(). Now wake on
lan works on Thinkpad X61(ICH8).
- Fix wm_access_phy_wakeup_reg_bm(). This change has no effect because
this function is used for WUC register and our driver currenlty
doesn't access to it.
- Call wm_enable_phy_wakeup() on PCH2 and newer, too. Now these devices
can do WOL. Tested with Thinkpad X220(PCH2).
- Set CTRL_MEHE correctly (PCH_{LPT,SPT} only).
- Add three workarounds for PCH_{LPT,SPT}.
- Fix a bug that 8257[56], 82580, I35[04] and I21[01] didn't use
wm_{get,release}_hw_control() correctly.
- Sync wm_smbustopci() with Linux and FreeBSD. This change effects PCH
and newer devices.
- Move the location of wm_smbustopci() call.
- Fix flag check in wm_get_wakeup()
- 8254[17]* and 8257[124] should not set WM_F_ARC_SUBSYS_VALID.
- Add missing WM_T_82541_2 and WM_T_82547_2.
- Fix WOL related setting of the WUC register for other than PCH* in
wm_enable_wakeup(). Tested with 82567V(ICH8) and 82583V.
- Use common MII_ADDRMASK.
- igphy(4): No binary change:
- s/IGPPHY/IGPHY/
- Fix the definition of PLHR_VALID_CHANNEL_*
- Fix the definition of MSE_CHANNEL_*
- Add MII_IGPHY_POWER_MGMT.
- Add some KASSERT.
- Add comment. Modify comment.
- Add debug code.
 1.60.2.5  26-Feb-2016  snj branches: 1.60.2.5.2;
Pull up following revision(s) (requested by msaitoh in ticket #1102):
sys/dev/mii/igphy.c: 1.25
sys/dev/mii/ukphy.c: 1.48
sys/dev/pci/if_wm.c: revisions 1.308, 1.318, 1.320, 1.324-1.332, 1.334, 1.336, 1.343-1.344, 1.347-1.348, 1.350, 1.376-1.382, 1.386-1.389 via patch
sys/dev/pci/if_wmreg.h: revisions 1.68-1.70, 1.73-1.77, 1.79-1.80, 1.82, 1.86-1.88 via patch
sys/dev/pci/if_wmvar.h: revisions 1.22-1.23, 1.25-1.30 via patch
Sync wm(4) as of if_wm.c rev 1.389 except MSI/MSI-X, multiqueue and NET_MPSAFE:
- Add C2000 KX and 2.5G support.
- Set ICH9 and ICH10's PBA size to 14K if the RX buffer size is more than
4096. Almost the same as other OSes.
- For 82576 and newer devices, the PBA register is deleted. Don't write PBA
for those chips. Also change the calculation of RX packet buffer size in
new way.
- Fix a lot of bugs to make 82575 and newer SERDES based systems work.
- Print NVM image version and option ROM version.
- Add workaround for I210 Errata 25 and I211 Errata 10 (PLL bug). This
workaround is required if the NVM image version < 3.25.
- Fix a bug that wm_detach() didn't unmap the FHASH's area. Now
"drvct -d wm0" -> "drvctl -r pci0" works on ICH* and PCH*.
- Add workaround for 82574 Errata 25 and 82583 Errata 12 "Dropped RX packets"
and for 82573 (unknown). Set GCR_L1_ACT_WITHOUT_L0S_RX bit. The NVM Image
version 2.1.4 and newer have this workaround.
- Check PHY type correctly. This change is required to use igphy(4) device
correctly.
- Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH* too.
- Call wm_get_hw_control() correctly. This change fixes a bug that some AMT
based systems doesn't linkup at 1000BaseT. The problem was observed on HP
Compaq dc7700. A lot of fixes have been done for wm(4) and igphy(4), so now
PR#44893 should be fixed.
- Call wm_get_wakeup(sc) before checking WM_F_HAS_AMT. It's required to
check the existence of AMT correctly.
- Fix a problem that wm_gate_hw_phy_config_ich8lan() isn't called in
wm_reset() on PCH2.
- Clear WMREG_WUC in wm_reset() if the chip >= 82544. This might fix the
behavior on suspend/resume.
- Fix logic of wm_check_reset_block() on ICH* and PCH*. This change might fix
a problem that PHY's read/write functions can't get semaphore.
- On ICH8, call wm_gig_downshift_workaround_ich8lan() when link changed down.
- Drop PHY_CTRL_GBE_DIS explicitly in wm_lplu_d0_disable() in case BIOS sets
this bit.
- Fix two bugs in wm_kmrn_lock_loss_workaround_ich8lan(). Now the function
checks the status correctly but it causes linkdown up to 10 times, so it's
disabled for the time being.
- PR/50527: David Binderman: Fix impossible code. Odd offsets need special
treatment.
- Fix RAL table's size of PCH2 and PCH_LPT.
- PCH_LPT (and newer device) is required to check FWSM_WLOCK_MAC bit to
determine the range of the RAL.
- Use sc->sc_itr instead of hard-coded number.
- Rename wm_tbi_check_link() to wm_tbi_tick() because this function acts as
mii_tick().
- ACK Accelerate Disable in the RFCTL register is not bit 13 but 12.
No binary change because this definition has not used yet.
- Add ACK data Disable bit's definition (not used yet).
- PHY_CTRL_GBE_DIS is not bit 4 but bit 6. This change has no any effect by
default because WM_WOL is not defined yet and
m_kmrn_lock_loss_workaround_ich8lan() is broken.
- Fix wm_check_mng_mode_ich8lan(). This function is used only when WM_WOL is
defined and it's disabled by default.
- Rename wm_check_reset_block() to wm_phy_resetisblocked() and make it returns
bool. No functional change.
- Reorder function definitions and macro definitions. No functional change.
- Fix comment. Add comment. Update comment.
- KNF.
 1.60.2.4  10-Jun-2015  snj Pull up following revision(s) (requested by msaitoh in ticket #833):
sys/dev/pci/if_wm.c: revisions 1.322, 1.323
sys/dev/pci/if_wmreg.h: revision 1.72
- Currently, WM_F_EEE bit is not set on all chips. It's intened to not
to use all of EEE fuctions but wm_set_eee_i350() leaves IPCNFG_10BASE_TE
bit and it causes link negotiation problem on some old switches. Disable
10BASE-Te function, too.
- Call wm_set_eee_i350() on some chips, too.
--
Fix a bug that flags related to semaphore were incorrectly checked in
wm_kmrn_{readreg,writereg}. i80003, ICH* and PCH* had this problem.
 1.60.2.3  19-May-2015  snj Pull up following revision(s) (requested by msaitoh in ticket #784):
sys/dev/pci/if_wm.c: revision 1.321
sys/dev/pci/if_wmreg.h: revision 1.71
sys/dev/pci/if_wmvar.h: 1.24 via patch
Add support iNVM (integrated Non-Volatile Memory) for I21[01].
This change fixes a bug that a MAC address is wrongly set on
iNVM machines/NICs.
 1.60.2.2  18-Mar-2015  snj Pull up following revision(s) (requested by msaitoh in ticket #614):
sys/dev/pci/if_wm.c: revision 1.311-1.313
sys/dev/pci/if_wmreg.h: revision 1.66
Fix a bug that sc_mediatype is evaluated incorrectly. The real problem
might be occured only on fiber and serdes cases.
#####
- Initialize some hardware bits for 8257[1234], 82583, 80003, ICH* and PCH*.
Some of them are workaround code. From other *BSDs, Linux and documents.
- Add comment.
- Fix typo in comment.
#####
Fix a bug that the first access to NVM is failed on 8254[17] which use
SPI EEPROM. Observed on Dell PowerEdge [12]850. Thanks Tom Ivar Helbekkmo
for debugging.
 1.60.2.1  07-Nov-2014  snj Pull up following revision(s) (requested by msaitoh in ticket #190):
sys/dev/pci/pcidevs 1.1201-1.1202 via patch
sys/dev/pci/if_wm.c 1.291-1.301, 1.304, 1.306-1.307 via patch
sys/dev/pci/if_wmreg.h 1.61-1.65 via patch
sys/dev/pci/if_wmvar.h 1.21 via patch
share/man/man4/wm.4 1.31 via patch
- Add Internal SERDES mode support newer than or equal to 82575.
- Add new I218 devices.
- Add DH89xxCC device.
- Add some old devices.
- Fix a bug that wm_get_swsm_semaphore() timed out when attaching device on
some machines.
- Fix a bug that the offset of alt MAC address is wrongly calculated to 0
when alt MAC address function is really used. This bug does not appear
as real bug if the same MAC address is written in the default location
and alt MAC address's location.
- Don't print "failed to detect NVM bank" message.
- Delete 82580ER related code.
- Fix typo in comment.
- Fix debug message.
- Cleanup
 1.60.2.5.2.2  13-Mar-2017  skrll Sync with netbsd-7-1-RELEASE
 1.60.2.5.2.1  18-Jan-2017  skrll Sync with netbsd-5
 1.65.2.8  28-Aug-2017  skrll Sync with HEAD
 1.65.2.7  05-Feb-2017  skrll Sync with HEAD
 1.65.2.6  05-Dec-2016  skrll Sync with HEAD
 1.65.2.5  29-May-2016  skrll Sync with HEAD
 1.65.2.4  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.65.2.3  22-Sep-2015  skrll Sync with HEAD
 1.65.2.2  06-Jun-2015  skrll Sync with HEAD
 1.65.2.1  06-Apr-2015  skrll Sync with HEAD
 1.89.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.89.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.94.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.98.6.19  29-Feb-2024  martin Pull up the following, requested by msaitoh in ticket #1938:

sys/dev/pci/if_wm.c 1.792,1.794-1.798 via patch
sys/dev/pci/if_wmreg.h 1.131

- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
- Drop frames if the RX descriptor ring has no room on multiqueue system.
- Improve dmesg output.
- Print RX packet buffer size.
- Fix the upper 16bit of Image Unique ID(EtrackID).
- Fix comment.
 1.98.6.18  18-Oct-2023  martin Pull up the following, requested by msaitoh in ticket #1915:

sys/dev/pci/pcidevs 1.1497
sys/dev/pci/if_wm.c 1.689,1.790-1.791 via patch
sys/dev/pci/if_wmreg.h 1.120 via patch
sys/dev/pci/if_wmvar.h 1.51

- Use 12K for packet buffer for jumbo frame on PCH2 and newer.
- Add new workaround for Tiger Lake and newer to avoid packet loss.
- Add I219{V,LM}({22,23}) devices (Raptor Lake).
 1.98.6.17  27-Jun-2023  martin Pull up the following revisions, requested by msaitoh in #1847:

sys/dev/pci/if_wm.c 1.768-1.782 via patch
sys/dev/pci/if_wmreg.h 1.129-1.130
sys/dev/pci/if_wmvar.h 1.49

wm(4):
- Rework for event counters:
- Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
- Rearrange the order of the registers so that they are roughly
in ascending order.
- Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach()
to match.
- IC{TX,RX}*C registers are for older than 82575.
- Fix a bug that the transmit underrun counter is incorrectly
counted.
- Don't add "Count" for event counter's description.
- Some statistics registers were replaced with new counters on newer
chips. Treat 0x403c(CEXTERR->HTDPMC), 0x40fc(TSCTFC->CBRMPC),
0x4124(ICRXOC->HTCBDPC) and from 0x4104 to 0x4124.
- Add some new counters:
- Circuit Breaker TX Manageability Packet
- Circuit Breaker RX Dropped Packet
- Host Good Octets RX
- Host Good Octets TX
- Length Errors
- SerDes/SGMII Code Violation Packet
- Header Redirection Missed Packet
- EEE TX LPI
- EEE RX LPI
- Fix prc511's comment and description.
- Add SOICZIFDATA (ifconfig -z) support for evcnt(9).
- Use WM_IS_ICHPCH(). No functional change.
- Fix typo. s/ictxact/ictxatc/. No functional change.
- Add comment.
 1.98.6.16  23-Jan-2023  martin Pull up the following revisions, requested by msaitoh in ticket #1795:

sys/dev/pci/if_wm.c 1.764-1.767 via patch
sys/dev/pci/if_wmreg.h 1.128

- Workaround for some hypervisor environments. The environments
cannot stop e1000 interrupt immediately.
- Rename nq_txdesc' member "nqrx_ctx" to "nqtx_ctx". No functional
change.
- Add comment. Modify comment.
- KNF.
 1.98.6.15  07-Sep-2022  martin Pull up the following revisions, requested by msaitoh in ticket #1759:

sys/dev/pci/if_wm.c 1.741-1.749,1.753-1.757,
1.762 via patch
sys/dev/pci/if_wmreg.h 1.126-1.127

- Fix I219 workaround in wm_flush_desc_rings().
- Add more statistics counters.
- To avoid releasing mutex temporally, use new
wm_set_mdio_slow_mode_hv_locked().
- No functional changes:
- Turn a locking botch (shouldn't drop lock on error) into a KASSERT
in wm_deferred_start_locked().
- Remove unneeded header inclusion.
- Use __BIT() a little.
- Modify comment and debug messages.
- Consistency use -1 instead of 1 for some error code.
- KNF.
 1.98.6.14  11-Jul-2022  martin Pull up the following revisions, requested by msaitoh in ticket #1751:

sys/dev/pci/if_wmreg.h 1.122-1.125 via patch
sys/dev/pci/if_wmvar.h 1.48
sys/dev/pci/if_wm.c 1.719-1.720,1.722-1.725,
1.727-1.740 via patch

- wm_tick: Add missing splx(s) when not WM_MPSAFE.
- Print DMA range info if the system is booting in the verbose mode.
- Micro optimization:
- Call m_freem(m) only if m0 == NULL.
- Call wm_xxeof() only when limit > 0.
- Don't set the more flag when there is no packet to process.
- No functional changes:
- Call txeof first, then rxeof for the consistency.
- Remove duplicated break.
- Remove stray semicolons from struct declaration.
- Fix value return from void function.
- Use macros.
- Modify comment.
- KNF.
 1.98.6.13  20-Nov-2021  martin Pull up the following, requested by msaitoh in ticket #1707:

sys/dev/pci/if_wm.c 1.716-1.718 via patch
sys/dev/pci/if_wmreg.h 1.121
sys/dev/mii/ihphy.c 1.20

- Fix a bug that device timeout still happens when the link is down
on ICH/PCH. Fixes PR kern/56478.
- Add some sysctl info for debugging.
- ihphy(4): Don't power down the PHY when the interface goes down.
- Use macro. Fix comment.
 1.98.6.12  05-Aug-2020  martin Pull up the following revisions, requested by msaitoh in ticket #1594:

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

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

sys/dev/pci/if_wm.c 1.650, 1.652-1.654 via patch
sys/dev/pci/if_wmreg.h 1.116-1.117

- Set CTRL_ILOS(Invert loss of signal) bit correctly on 82580
port 1, 2, 3 and newer chips. This change fixes a bug that some
fiber, serdes or SFP devices don't detect the link status correctly.
- Simplify code by using "struct mii_data *mii" more. No functional
change.
- MSI-X doesn't use sc->sc_icr variable, so move the code into
non-MSI-X part. No functional change intended.
- Modify debug printfs a bit.
- Rename macro.
- Use __BIT()
- Fix comment. Add comment.
- KNF.
 1.98.6.10  01-Aug-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1312):

sys/dev/pci/if_wm.c: revision 1.644
sys/dev/pci/if_wm.c: revision 1.645
sys/dev/pci/if_wmreg.h: revision 1.115

Define RETA_ENTRY_MASK_Q(used in RSS redirection table) correctly.
Found by UBSan.

Use aprint_debug_dev() instead of printf() in wm_ulp_disable().

- rnd_add_*() call must be serialized. Unserialized accesses broke the
sc->rnd_source structure and caused off by one in kern_rndq.c's
rnd_add_data_ts(). This problem was found by kUBSan. Make krndsource_t's
data per queue-pair and call rnd_add_uint32() in wm_txrxintr_msix(). One of
the reason why rnd_add_uint32() calls were moved from wm_{tx,rx}eof() is that
rnd(9) manual page says "To allow the system to gather the timing information
accurately, this call should be placed within the actual hardware interrupt
service routine."

- Pass a better value to rnd_add_uint32() in wm_intr_legacy().
XXX pullup-8.
 1.98.6.9  17-Jul-2019  martin Pull up the following revisions (via patch), requested by msaitoh in
ticket #1298:

sys/dev/pci/if_wm.c 1.633, 1.637-1.641
sys/dev/pci/if_wmreg.h 1.114

- Use unsigned to avoid undefined behavior.
- Print ICH/PCH's NVM version.
- Fix typo in comment. u_int*_t -> uint*_t. Whitespace fix.
 1.98.6.8  07-Mar-2019  martin Pull up the following, requested by msaitoh in ticket #1206:

sys/dev/pci/if_wmreg.h 1.113
sys/dev/pci/if_wmvar.h 1.43-1.44
sys/dev/pci/if_wm.c 1.626-1.627, 1.629-1.636 via patch

- Add support for I210 SGMII Flash-less device.
- Add I219 variations for Cannon Lake.
- Add missing rnd_detach_source().
- Use do { ... } while (0) for DPRINTF(x, y).
- Swap enumeration of 82578 and 82577 PHY in if_wmvar.h. No functional
change.
- Add KASSERT.
- Update TODO list. Add comment. Fix typo in comment.
 1.98.6.7  31-Jan-2019  martin Pull up the following, requested by msaitoh in ticket #1179:

sys/dev/pci/if_wm.c 1.603-1.605,1.607-1.611,
1.613,1.615,1.618-1.620
via patch
sys/dev/pci/if_wmreg.h 1.110-1.111
sys/dev/pci/if_wmvar.h 1.40-1.42
sys/dev/mii/inbmphyreg.h 1.13-1.15

- Add some code for suspend/resume:
- Rename wm_smbustopci() to wm_init_phy_workarounds_pchlan(). It will
also called when resume.
- Call wm_phy_resetisblocked() after PHY reset in
wm_init_phy_workarounds_pchlan() to wait for the PHY to quiesce to
an accessible state.
- Add new wm_resume_workarounds_pchlan() function and use it in
wm_resume(). This workaround is only for PCH2 and newer.
- Don't call wm_disable_aspm() neither in wm_attach() nor in
wm_resume() but in wm_reset().
- Do some initialization in wm_resume() when IFF_UP is NOT set.
- Don't continue when it failed to acquire semaphore in
wm_ulp_disable().
- Print CLSEM workaround bit correctly.
- Fix availability detection of WoL on some chips.
- Print the WUS (WakeUp Status) register bits when resume.
- Don't setup WoL on non-WoL capable port.
- Setup PHY wakeup feature on PCH and newer. Tested on Thinkpad X220.
- Remove an extra register read in
wm_kmrn_lock_loss_workaround_ich8lan().
- Don't leave the MDICNFG register modified when the Power Management
capability offset can't get.
- Reduce indent level of wm_linkintr_gmii(). No functional change.
- 80003's SERDES is not the same as 82575's but the same as legacy
devices. Use the old methods on 80003.
- Use __nothing for null DPRINTF().
- Rename functions. Add comment.
 1.98.6.6  04-Dec-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #1117):

sys/dev/pci/if_wmreg.h: revision 1.109
sys/dev/pci/if_wm.c: revision 1.597
sys/dev/pci/if_wm.c: revision 1.598
sys/dev/mii/inbmphyreg.h: revision 1.12
sys/dev/pci/if_wm.c: revision 1.600
sys/dev/pci/if_wm.c: revision 1.601
sys/dev/pci/if_wm.c: revision 1.602

- Add new wm_gmii_{hv,i82544}_{read,write}reg_locked() and use them in
wm_gmii_{hv,i82544}_{read,write}reg(). *_locked() functions are not
mii(4) API functions, so it's not required to keep the mii API. Change
the PHY register type from int to uint16_t. It also change the usage of
return value. It returns zero on success and non-zero on error.
- Check the return value of *_locked() function and treat it.
- Use *writereg_locked() function to reduce race condition in
wm_init_lcd_from_nvm().
- Add comment.
- Control TX/RX descriptor snooping control bits on ICH8 and newer.
Only on ICH8, No-snoop bits are opposite polarity. On my Thinkpad X61,
the default value of this bits are all zero, so this commit changes
the snoop function enable on the machine. I tested with some other
PCH machines and those bits are all zero (enable snoop by default),
so this commit won't affect to some machines.
- Disable relax ordering on 82546GB(Device ID 0x1099 and 0x10b5) or >= ICH8.
Same as other OSes.
- Add wm_oem_bits_config_ich8lan() to control LPLU and GbE setting base on
the NVM's info.
- Modify wm_enable_wakeup() to reduce difference against FreeBSD and Linux.
This modification affects to ICH8 and newer devices. I217 Rapid Start
Technology support have not written yet (it's TODO).
- Add wm_k1_workaround_lv() from FreeBSD. It's PCH2 specific:
Workaround to set the K1 beacon duration for 82579 parts in 10Mbps.
Disable K1 for 1000 and 100 speeds.
- Make wm_link_stall_workaround_hv() and move an 82578 specific code into it.
Don't apply the workaround if BMCR_LOOP bit is set. Same as FreeBSD.
- Add comment. Modify comment.
Fix comment. No functional change.
 1.98.6.5  08-Nov-2018  martin Pull up the following, requested by msaitoh in tickt #1085:

sys/dev/mii/inbmphyreg.h 1.11
sys/dev/pci/if_wmreg.h 1.108
sys/dev/pci/if_wm.c 1.590-1.596 via patch

- 82574 and newer document says the status field has neither EC
(Excessive Collision) bit nor LC (Late Collision) bit (reserved), so
don't check the bit.
- Add workaround for DMA hang problem which result in TX device timeout
on PCH_LPT with I218. Same as FreeBSD and Linux. This workaround is
only for device ID 0x155a, 0x15a2, 0x1559 and 0x15a3.
- Fix a PCH2 specific bug that wrong PHY register value can be read
when boot. Same as FreeBSD and Linux.
- After writing MDIC register, don't read quickly the same register but
do delay(50). Same as other OSes.
- Add missing wm_gate_hw_phy_config_ich8lan(false) in
wm_phy_post_reset() on PCH2. wm_gate_hw_phy_config_ich8lan(true) is
called in wm_reset(), so wm_gate_hw_phy_config_ich8lan(false) should
be called after reset in wm_phy_post_reset().
- On PCH2, set the phy config counter to 50msec after (PHY) reset.
- KNF & Use macro.
 1.98.6.4  16-Apr-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #764):

sys/dev/pci/if_wm.c: revision 1.567
sys/dev/pci/if_wm.c: revision 1.568
sys/dev/pci/if_wm.c: revision 1.569
sys/dev/pci/if_wmvar.h: revision 1.38
sys/dev/pci/if_wm.c: revision 1.570
sys/dev/pci/if_wm.c: revision 1.571
sys/dev/pci/if_wm.c: revision 1.572
share/man/man4/wm.4: revision 1.40
sys/dev/pci/if_wmreg.h: revision 1.106
sys/dev/pci/if_wmreg.h: revision 1.107

SW PHY Config Enable bit for ICH8 B0 stepping is not bit 1 but bit 0.

No binary change:
- Sort registers.
- Lowercase hexadecimal value.

On PCH_SPT (and newer), FLASH access should be done by 32bit.
Especially for ICH_FLASH_HSFCTL register, it's located at 0x0006, so
it should be accessed via ICH_FLASH_HSFSTS(0x0004) and use shift or mask.

Our PCH_SPT part of wm_nvm_valid_bank_detect_ich8lan() was based on
FreeBSD r287467. After that, they reverted it and committed the different
code in r287762. r287762's bank detect code didn't work for us because our wm
dirver had a problem in flash access. The problem was fixed in if_wm.c rev.
1.567, so we can use the new way now.

If the extended configration size in the EXTCNFSIZE register is 0, don't
continue.
Add PCH_CNP support (I219 with Intel 300 series chipset).
It's required more test, so it's disabled by default.

Enable I219.

I354 uses an external PHY, so don't use wm_set_eee_i350().
 1.98.6.3  24-Nov-2017  martin Pull up following revision(s) (requested by msaitoh in ticket #389):
sys/net/if_ether.h: revision 1.69
sys/net/if_vlan.c: revision 1.108
sys/dev/pci/if_bge.c: revision 1.313
sys/net/if_vlanvar.h: revision 1.11
sys/net/if_vlanvar.h: revision 1.12
sys/net/if_ether.h: revision 1.70
sys/net/if_vlan.c: revision 1.110
sys/dev/pci/if_wm.c: revision 1.544
sys/dev/pci/if_wmreg.h: revision 1.105
Fix a bug that a vlan packet which has priority or CFI bit in the tag causes
panic.
Revert part of if_bge.c 1.312. It's not required to mask other than VLAN ID
bits in VLAN tag.
Revert if_wmreg.h 1.104 and if_wm.c 1.542. It's not required to mask other
than VLAN ID bits in VLAN tag.
No functional change:
- u_int16_t -> uint16_t
- u_short -> uint16_t
- tag_hash_func -> vlan_tag_hash
- 0 -> NULL because vlr_parent is a pointer.
 1.98.6.2  06-Nov-2017  snj Pull up following revision(s) (requested by knakahara in ticket #348):
sys/dev/pci/if_wm.c: revision 1.542
sys/dev/pci/if_wmreg.h: revision 1.104
fix wm(4) vlan panic. Reported and tested by Tom Ivar Helbekkmo, thanks.
wm(4) used PRI bits and CFI bit as vlantag by mistake. It is found out
by if_ether.h:r1.67.
 1.98.6.1  01-Aug-2017  snj Pull up following revision(s) (requested by msaitoh in ticket #173):
sys/dev/pci/if_wmreg.h: 1.99-1.103
sys/dev/pci/if_wmvar.h: 1.34-1.37
sys/dev/pci/if_wm.c: 1.510-1.537
sys/dev/mii/ihphyreg.h: 1.2
sys/dev/mii/inbmphyreg.h: 1.10
sys/dev/mii/igphy.c: 1.27
Sync wm(4) up to if_wm.c rev. 1.537:
- Set WMREG_KABGTXD not in wm_init_locked() but in wm_reset().
- If a legacy interrupt is a spurious interrupt, don't print debug
message.
- Don't print the Image Unique ID if an NVM is iNVM (i210 and I211).
- Fix a bug that a RAL was written at incorrect address when the index
number is more than 16 on 82544 and newer.
- The layout of RAL on PCH* are different from others. Fix it.
- Flush every MTA write. Same as Linux.
- Move the location of calling wm_set_filter. Same as some other OSes.
- Flush writing WMREG_CTRL in wm_gmii_mediachange().
- Make new wm_phy_post_reset() and use this function at all location
after resetting phy.
- Add I219 specific workaround for legacy interrupt. From OpenBSD.
- Move the location of calling wm_lplu_d0_disable().
- Disable D0 LPLU on 8257[12356], 82580, I350 and I21[01], too. Before
this commit, above devices and non-PCIe devices accessed wrong
register.
- Fix latency calculation in wm_platform_pm_pch_lpt().
- Set OBFF water mark and enable OBFF on PCH_LPT and newer.
- Fix a bug that wm_gmii_i82544_{read,write}reg() didn't take care of
page select. PHY access from igphy() automatically did it, but
accessing from wm(4) for workaround didn't work correctly. This
change affects 8254[17], 8257[12] ICH8, ICH9 and ICH10.
- Call wm_kmrn_lock_loss_workaround_ich8lan() before any PHY access in
wm_linkintr_gmii().
- Register access in wm_kmrn_lock_loss_workaround_ich8lan() now works
correctly. Enable this function.
- IF TX is not required to flush, RX is also not required to flush in
wm_flush_desc_rings(). Same as other OSes.
- Remove wrong semaphore access in wm_nvm_{read,write}_{ich8,spt} to
prevent hangup. A semaphore is get/put in wm_nvm_{read,write}.
- Move some initialization stuff in wm_attach() before wm_reset().
Some flags and callback function is required to set correctly before
wm_reset() because wm_reset() and some helper functions refer them.
- Add wm_write_smbus_addr() to set SMBus address by software.
- Modify wm_gmii_hv_{read,write}reg_locked() to make them access
HV_SMB_ADDR correctly.
- Configure the LCD with the extended configuration region in NVM if
it's required. Tested with Thinkpad X220.
- 8257[12]: Don't directly access SPI but use EERD register.
- 82575-I354: If the size of SPI ROM >= 32K words, use direct SPI
access instead of EERD register access.
- Add wm_nvm_eec_clock_raise() and wm_nvm_eec_clock_lower() and use
them for Microwire/SPI bus control. Same as Linux and FreeBSD.
- Reduce timeout value for 80003 in wm_get_swfw_semaphore(). Same as
Linux and FreeBSD.
- Change API of kmrn_{read,write}reg() and check the return value.
- Check whether it's required to use MDIC workaround for 80003 or not
in wm_reset(). If the workaround isn't required, don't use the
workaround code in wm_gmii_i80003_{read,write}reg.
- Add WM_F_WA_I210_CLSEM flag for a workaround. FreeBSD/Linux drivers
say "In rare circumstances, the SW semaphore may already be held
unintentionally." on I21[01]. PXE boot is one of the case.
- Qemu's e1000e emulation (82574L)'s SPI has only 64 words. I've never
seen on real 82574 hardware with such small SPI ROM. Check
NVM word size before accessing higher address words to prevent
timeout.
- Check some wm_nvm_read()'s return vale.
- Use device_printf() instead of aprint_error_dev() for PHY read/write
functions because those are used not only in device attach.
- Print internal driver flags when attaching.
- Add debug printf()s.
- Rename variables.
- Add comment, update comment and remove wrong comment.
 1.105.2.3  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.105.2.2  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.105.2.1  16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.107.2.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.107.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.107.2.1  10-Jun-2019  christos Sync with HEAD
 1.115.2.9  23-Feb-2024  martin Pull up the following, requested by msaitoh in ticket #1802:

sys/dev/pci/if_wm.c 1.794-1.798 via patch
sys/dev/pci/if_wmreg.h 1.131

- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
- Drop frames if the RX descriptor ring has no room on multiqueue
system.
- Improve dmesg output:
- Print RX packet buffer size.
- Fix the upper 16bit of Image Unique ID(EtrackID).
 1.115.2.8  27-Jun-2023  martin Pull up the following revisions, requested by msaitoh in #1656:

sys/dev/pci/if_wm.c 1.768-1.782 via patch
sys/dev/pci/if_wmreg.h 1.129-1.130
sys/dev/pci/if_wmvar.h 1.49

wm(4):
- Rework for event counters:
- Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
- Rearrange the order of the registers so that they are roughly
in ascending order.
- Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach()
to match.
- IC{TX,RX}*C registers are for older than 82575.
- Fix a bug that the transmit underrun counter is incorrectly
counted.
- Don't add "Count" for event counter's description.
- Some statistics registers were replaced with new counters on newer
chips. Treat 0x403c(CEXTERR->HTDPMC), 0x40fc(TSCTFC->CBRMPC),
0x4124(ICRXOC->HTCBDPC) and from 0x4104 to 0x4124.
- Add some new counters:
- Circuit Breaker TX Manageability Packet
- Circuit Breaker RX Dropped Packet
- Host Good Octets RX
- Host Good Octets TX
- Length Errors
- SerDes/SGMII Code Violation Packet
- Header Redirection Missed Packet
- EEE TX LPI
- EEE RX LPI
- Fix prc511's comment and description.
- Add SOICZIFDATA (ifconfig -z) support for evcnt(9).
- Use WM_IS_ICHPCH(). No functional change.
- Fix typo. s/ictxact/ictxatc/. No functional change.
- Add comment.
 1.115.2.7  23-Jan-2023  martin Pull up the following revisions, requested by msaitoh in ticket #1578:

sys/dev/pci/if_wm.c 1.764-1.767 via patch
sys/dev/pci/if_wmreg.h 1.128

- Workaround for some hypervisor environments. The environments
cannot stop e1000 interrupt immediately.
- Rename nq_txdesc' member "nqrx_ctx" to "nqtx_ctx". No functional
change.
- Add comment. Modify comment.
- KNF.
 1.115.2.6  07-Sep-2022  martin Pull up the following revisions, requested by msaitoh in ticket #1515:

sys/dev/pci/if_wm.c 1.741-1.749,
1.753-1.757,
1.762 via patch
sys/dev/pci/if_wmreg.h 1.126-1.127

- Fix I219 workaround in wm_flush_desc_rings().
- Add more statistics counters.
- To avoid releasing mutex temporally, use new
wm_set_mdio_slow_mode_hv_locked().
- No functional changes:
- Turn a locking botch (shouldn't drop lock on error) into a KASSERT
in wm_deferred_start_locked().
- Remove unneeded header inclusion.
- Use __BIT() a little.
- Modify comment and debug messages.
- Consistency use -1 instead of 1 for some error code.
- KNF.
 1.115.2.5  11-Jul-2022  martin Pull up the following revisions, requested by msaitoh in ticket #1477:

sys/dev/pci/if_wmreg.h 1.122-1.125
sys/dev/pci/if_wmvar.h 1.48
sys/dev/pci/if_wm.c 1.719-1.720,
1.722-1.725,
1.727-1.740 via patch

- wm_tick: Add missing splx(s) when not WM_MPSAFE.
- Print DMA range info if the system is booting in the verbose mode.
- Micro optimization:
- Call m_freem(m) only if m0 == NULL.
- Call wm_xxeof() only when limit > 0.
- Don't set the more flag when there is no packet to process.
- No functional changes:
- Call txeof first, then rxeof for the consistency.
- Remove duplicated break.
- Remove stray semicolons from struct declaration.
- Fix value return from void function.
- Use macros.
- Modify comment.
- KNF.
 1.115.2.4  20-Nov-2021  martin Pull up the following, requested by msaitoh in ticket #1373:

sys/dev/pci/if_wm.c 1.716-1.718 via patch
sys/dev/pci/if_wmreg.h 1.121
sys/dev/mii/ihphy.c 1.20

- Fix a bug that device timeout still happens when the link is down
on ICH/PCH. Fixes PR kern/56478.
- Add some sysctl info for debugging.
- ihphy(4): Don't power down the PHY when the interface goes down.
- Use macro. Fix comment.
 1.115.2.3  23-Sep-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1093):

sys/dev/pci/if_wmreg.h: revision 1.120
sys/dev/pci/if_wmvar.h: revision 1.46
sys/dev/pci/if_wm.c: revision 1.686
sys/dev/pci/if_wm.c: revision 1.687
sys/dev/mii/inbmphyreg.h: revision 1.20
sys/dev/pci/if_wm.c: revision 1.688
sys/dev/pci/if_wm.c: revision 1.689

s/ressource/resource/. Found by knakahara.

Add new flag named WM_F_CRC_STRIP and use it. No functional change.

This change also sets the RCTL_SECRC bit on I211 but it doesn't change
the behavior because I211 always strips CRC like I35[04] and I210.

Add a workaround for jumbo frame on PCH2 and newer. Tested by chs@.

- Add wm_lv_jumbo_workaround_ich8lan() and use it. From FreeBSD.
XXX For KUMCTRLSTA_OFFSET_HD_CTRL register modification, it's doubtful.
FreeBSD and Linux do the same thing that they set the same value on both
jumbo frame's enable case and the disable case. It seems the default value
is 0x0b0c and it's not changed on the enable case, so it might be a bug
on the enable case or the modification is not required.
- Rename I219_UNKNOWN1 to I82579_UNKNOWN1.
Use 12K for packet buffer for jumbo frame on PCH2 and newer.

XXX Note that Linux Use 14K.
 1.115.2.2  10-Jul-2020  martin Pull up the following revisions, requested by msaitoh in ticket #994:

sys/dev/pci/if_wm.c 1.655-1.658, 1.660, 1.662, 1.664-1.668,
1.671-1.674, 1.678,1.680-1.681 via patch
sys/dev/pci/if_wmreg.c 1.118-1.119
sys/dev/pci/if_wmvar.c 1.45

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

sys/dev/pci/if_wm.c 1.650, 1.652-1.654
sys/dev/pci/if_wmreg.h 1.116-1.117

- Set CTRL_ILOS(Invert loss of signal) bit correctly on 82580
port 1, 2, 3 and newer chips. This change fixes a bug that some
fiber, serdes or SFP devices don't detect the link status correctly.
- Simplify code by using "struct mii_data *mii" more. No functional
change.
- MSI-X doesn't use sc->sc_icr variable, so move the code into
non-MSI-X part. No functional change intended.
- Modify debug printfs a bit.
- Rename macro.
- Use __BIT()
- Fix comment. Add comment.
- KNF.
 1.128.2.2  23-Feb-2024  martin Pull up following revision(s) (requested by msaitoh in ticket #607):

sys/dev/pci/if_wm.c: revision 1.795
sys/dev/pci/if_wm.c: revision 1.796
sys/dev/pci/if_wm.c: revision 1.797
sys/dev/pci/if_wmreg.h: revision 1.131

wm(4): Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.

The iqdrops counter should include not only MPC(Missed Packet Count)
but also RQDPC(Receive Queue Drop Packet Count). Same as ixgbe(4) and igc(4).

Note that the RQDPC is not currently counted because SRRCTL_DROP_EN
is not set.

wm(4): Drop frames if the RX descriptor ring has no room on multiqueue system.

Drop frames if the RX descriptor ring has no room. This is enabled only on
multiqueue system to avoid bad influence to other queues. The drop count
can be seen by the RQDPC counter (wmN rxqXXdrop evcnt).

wm(4): Fix compile error without WM_EVENT_COUNTERS.
 1.128.2.1  22-Jun-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #213):

sys/dev/pci/if_wm.c: revision 1.770
sys/dev/pci/if_wm.c: revision 1.771
sys/dev/pci/if_wm.c: revision 1.772
sys/dev/pci/if_wm.c: revision 1.773
sys/dev/pci/if_wm.c: revision 1.774
sys/dev/pci/if_wm.c: revision 1.775
sys/dev/pci/if_wm.c: revision 1.776
sys/dev/pci/if_wmreg.h: revision 1.129
sys/dev/pci/if_wm.c: revision 1.777
sys/dev/pci/if_wm.c: revision 1.778
sys/dev/pci/if_wmvar.h: revision 1.49
sys/dev/pci/if_wm.c: revision 1.779
sys/dev/pci/if_wm.c: revision 1.768
sys/dev/pci/if_wm.c: revision 1.769
sys/dev/pci/if_wmreg.h: revision 1.130
sys/dev/pci/if_wm.c: revision 1.780
sys/dev/pci/if_wm.c: revision 1.781

Count some 64bit counters correctly.
- Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
- Found by knakahara.

Add note for the TORL register.

The TOR register includes error, flow control and broadcast rejected.

Sort lines. No functional change.

Rearrange the order of the registers so that they are roughly in ascending
order.

Sort lines. No functional change.

Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach() to match.
IC{TX,RX}*C registers are for older than 82575.

Fix a bug that the transmit underrun counter is incorrectly counted.
The transmit underrun bit in the transmit status filed is only for 82544
(and older?), so don't use the counter for newer chips. The bit is reserved
for newer chips, but the bit sometimes set on 82575 at least.

Don't add "Count" for event counter's description.

Some statistics registers were replaced with new counters.
- 0x403c was CEXTERR(Carrier Extension Error). 82575 and newer except 80003,
ICHs and PCHs have HTDPMC(Host Tx Discarded Packets by MAC). I don't really
know for 82575. The 82575 datasheet say nothing about it.
- The following two are changed for circuit breaker. Only 82576's datasheet
describes abut it, so the registers might be only for 82576.
Use those registers for 82575 and newer except 80003, ICHs and PCHs just in
case.
- 0x40fc was TSCTFC(TCP Segmentation Context Tx Fail). It was replaced by
the CBRMPC(Circuit Breaker Rx Manageability Packet) register.
- 0x4124 was ICRXOC(Interrupt Cause Receiver Overrun). It was replaced by
the HTCBDPC(Host Tx Circuit Breaker Dropped Packet) register.
- From 0x4104 to 0x4124:
- For 0x4124, 82575's datasheet says it's not changed(ICRXOC).
I don't know if it's correct. We use new HTCBDPC register for 82575.
- 82576 and newer changed the meaning.
- I don't know for 80003, ICHs and PCHs. Don't count those registers.
At least, those registers in PCH2 and PCH_CNP are all zero.

Add some new event counters.

Add the following counters for 82575 and newer except 80003, ICHs and PCHs:
- Only 82576 document describes about the circuit breaker,
so the following two might be only for 82575:
- Circuit Breaker TX Manageability Packet
- Circuit Breaker RX Dropped Packet
- 82575's document doesn't describe the following two, but we can see
the same value as GO{T,R}C have:
- Host Good Octets RX
- Host Good Octets TX
- 82575's document doesn't describe the LENERRS (Length Errors) counter.
I don't know if it has.
- Perhaps Non-SerDes/SGMII devices don't have SCVPC
(SerDes/SGMII Code Violation Packet) register. We don't care if
it's SerDes/SGMII or not for now.
- HRMPC (Header Redirection Missed Packet) appears only once
in 8257[56]'s datasheet. FreeBSD's igb counts it, so we do, too.
- Count the following two for I350 and newer. I don't know if PCHs have:
- EEE TX LPI
- EEE RX LPI

Move statistics updating code from wm_tick() to new wm_update_stats().
- To reuse.
- No functional change.

Add SOICZIFDATA (ifconfig -z) support for evcnt(9).

First update the statistics data, then clear the event counters,
and finally copy and clear if_data via ether_ioctl().

Fix prc511's comment and description.

Use WM_IS_ICHPCH(). No functional change.

Fix typo. s/ictxact/ictxatc/. No functional change.

RSS XML Feed