Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/if_wmvar.h
RevisionDateAuthorComments
 1.51  11-Oct-2023  msaitoh wm(4): Add a new workaround for Tiger Lake and newer.

- Define new WM_T_PCH_TGP and use it for Tiger Lake and newer.
Note that we don't define WM_T_PCH_ADP because we have no any
Alder Lake specific workaround yet.
- Add new workaround for Tiger Lake (and newer) in wm_init_locked()
to avoid packet loss.
 1.50  25-Aug-2023  msaitoh Delay sending LINK_STATE_UP to prevent dropping packets on I35[04] and I21[01].

Some (not all) systems use I35[04] or I21[01] don't send packet soon
after linkup. The MAC send a packet to the PHY and any error is not
observed. This behavior causes a problem that gratuitous ARP and/or
IPv6 DAD packet are silently dropped. To avoid this problem, don't
call mii_pollstat() here which will send LINK_STATE_UP notification
to the upper layer. Instead, mii_pollstat() will be called in
wm_gmii_mediastatus() or mii_tick() will be called in wm_tick().

Note that the similar workaround is in Linux's igb driver though it's
only for I21[01].

OK'd by hikaru@ and knakahara@.
 1.49  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.48  20-Dec-2021  skrll branches: 1.48.4;
Trailing whitespace
 1.47  30-Oct-2020  msaitoh Add WMPHY_I350. Not used yet.
 1.46  15-Sep-2020  msaitoh 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.
 1.45  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.44  19-Feb-2019  msaitoh branches: 1.44.4;
Modify PHY tree in comment.
 1.43  07-Feb-2019  msaitoh Swap enumeration of 82578 and 82577. Same as FreeBSD. Chip Model number of
82578 is +1 from 82577 but 82577 is functionally newer than 82578 (and 82577's
MII_MODEL(0x05) is greater than 82578's (0x04)). This change doesn't affect any
behavior to if_wm.c (NFCI).

Add comment.
 1.42  25-Dec-2018  msaitoh Add comment.
 1.41  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.40  14-Dec-2018  msaitoh Print CLSEM workaround bit correctly.
 1.39  08-Aug-2018  msaitoh Add MDIC_WA and CLSEMWA to snprintb() string for WM_F_* flags.
 1.38  12-Apr-2018  msaitoh branches: 1.38.2;
Add PCH_CNP support (I219 with Intel 300 series chipset).
It's required more test, so it's disabled by default.
 1.37  27-Jul-2017  msaitoh branches: 1.37.2;
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.

XXX pullup-[678].
 1.36  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.35  25-Jul-2017  msaitoh Use new nvm.{acquire,release}() for semaphore. Almost the same except the
following:
- 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.
- Redude timeout value for 80003 in wm_get_swfw_semaphore(). Same as
Linux and FreeBSD.
 1.34  26-Jun-2017  msaitoh Print sc_flags with snprintb().
 1.33  01-Feb-2017  msaitoh branches: 1.33.6;
Use new wm_gmii_setup_phytype() function to setup sc_phytype and
mii_{read|write}reg. This function is called twie.

To identify PHY type, correct read/write function should be selected. To
select correct read/write function, PCI ID or MAC type are required without
accessing PHY registers.

On the first call of this function, PHY ID is not known yet. Check PCI ID or
MAC type. The list of the PCI ID may not be perfect, so the result might be
incorrect.

In the second call, PHY OUI and model are used to identify PHY type. It might
not be perfpect because of the lack of compared entry, but it would be better
than the first call.

If the detected new result and previous assumption is different, diagnous
message will be printed.
 1.32  28-Oct-2016  msaitoh branches: 1.32.2;
- 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.
 1.31  06-May-2016  msaitoh branches: 1.31.2;
Basic support for I219. It doesn't work on I219, so it's disabled.
 1.30  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.29  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.28  06-Jun-2015  msaitoh Print NVM image version.
 1.27  06-Jun-2015  msaitoh Revert previos. Sorry, I committed in another working directory...
 1.26  06-Jun-2015  msaitoh Print NVM image version.
 1.25  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.24  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.23  27-Nov-2014  msaitoh branches: 1.23.2;
Fix typo in comment.
 1.22  25-Nov-2014  msaitoh Add note about the variations of Intel gigabit Ethernet controller.
 1.21  06-Oct-2014  msaitoh Delete 82580ER related code. It was from FreeBSD and was removed in r203049.
 1.20  24-Aug-2014  msaitoh 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.
 1.19  14-Jul-2014  msaitoh branches: 1.19.2;
Cleanup comments. No functional change.
 1.18  11-Jul-2014  msaitoh Rename some WM_F_* flags to clarify. Renumbering flags. No functional change.

WM_F_EEPROM_HANDSHAKE -> WM_F_LOCK_EECD
WM_F_EEPROM_SEMAPHORE -> WM_F_LOCK_SWSM
WM_F_SWFW_SYNC -> WM_F_LOCK_SWFW
WM_F_SWFWHW_SYNC -> WM_F_LOCK_EXTCNF
 1.17  29-Dec-2013  msaitoh branches: 1.17.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.16  02-Jun-2013  msaitoh branches: 1.16.2;
Add I217 (and I218) support.
- The name of I217 is similar to I210, but the function is rather similar to
PCH2.
- Not tested well. Tested with my own Intel DQ87PG which has I217LM onboard.
- It seems that PCH2 and PCH_LPT specific function for RAL should be written.
- Quick hack for the NVM checksum mismatch. if_wm.c currently has no
wm_write_eeprom(), so it cannot update NVM's "updated bit". To avoid this
problem, check only the last 12bits of the checksum. My own DQ87PG's
updated bit is not set, and I could avoid the problem using with this
hack.
 1.15  18-Apr-2013  msaitoh Add support I21[01]. Only tested with my own I210-T1 Ethernet Server Adapter.
 1.14  12-Feb-2013  msaitoh Use 82580(and I350) specific PHY read/write functions.
Fixes PR#47542.
 1.13  25-May-2012  msaitoh branches: 1.13.2;
Add support Intel I350 Ethernet.
 1.12  20-May-2011  msaitoh branches: 1.12.4; 1.12.8; 1.12.10;
Add PCH2 support.
 1.11  07-Mar-2010  msaitoh branches: 1.11.2; 1.11.4; 1.11.6;
- 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.10  25-Feb-2010  msaitoh Merge if_wm.c rev. 1.162.4.13 and if_wmvar.h rev. 1.2.46.3 into maintrunk.
Increase the timeout value to prevent timeout on 80003. The values are taken
from Intel's e1000 driver. Tested by spz and me.
 1.9  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.8  14-Jan-2010  msaitoh branches: 1.8.2;
Fixes the rx stall problem on 82578 by MANY workaround code.
We need more work for 82577.
 1.7  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.6  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.5  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.4  16-Dec-2009  msaitoh Sync with Intel's original em 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 wrote.
- Save and restore register 0x2f5b.
 1.3  16-Dec-2009  msaitoh Re-enable 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]

see http://mail-index.netbsd.org/tech-net/2009/08/05/msg001546.html
 1.2  22-Feb-2006  gavan branches: 1.2.40; 1.2.46;
Convert MD hook to device property reads.

Device properties, if present, take precedence over EEPROM values.
 1.1  16-Feb-2006  gavan branches: 1.1.2;
Compute the EEPROM checksum to determine the presence of valid EEPROM data.
If EEPROM data is invalid, allow a MD hook to supply EEPROM data instead.
 1.1.2.3  01-Mar-2006  yamt sync with head.
 1.1.2.2  18-Feb-2006  yamt sync with head.
 1.1.2.1  16-Feb-2006  yamt file if_wmvar.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:08 +0000
 1.2.46.7  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.2.46.6  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.2.46.5  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.2.46.4  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.2.46.3  25-Feb-2010  sborrill Fix regression caused by pullup #1277 requested by msaitoh.
 1.2.46.2  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.2.46.1  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.2.40.1  11-Mar-2010  yamt sync with head
 1.8.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.11.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.11.4.2  21-Apr-2010  matt sync to netbsd-5
 1.11.4.1  07-Mar-2010  matt file if_wmvar.h was added on branch matt-nb5-mips64 on 2010-04-21 00:27:42 +0000
 1.11.2.1  31-May-2011  rmind sync with head
 1.12.10.7  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.12.10.6  30-Apr-2015  snj Pull up following revision(s) (requested by msaitoh in ticket #1296):
sys/dev/pci/pcidevs: revision 1.1195 via patch
sys/dev/pci/if_wm.c: revisions 1.290, 1.304 via patch
sys/dev/pci/if_wmvar.h: revision 1.20 via patch
- 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.
- Support DH89xxCC device.
- Add extra delay for 82580 and newer devices except DH89XXCC SGMII device.
Same as FreeBSD.
 1.12.10.5  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.12.10.4  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.12.10.3  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.12.10.2  14-Feb-2013  jdc Pull up revisions:
src/sys/dev/pci/if_wm.c revision 1.243
src/sys/dev/pci/if_wmvar.h revision 1.14
(requested by msaitoh in ticket #820).

Use 82580(and I350) specific PHY read/write functions.
Fixes PR#47542.
 1.12.10.1  28-Jun-2012  riz 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.12.8.1  02-Jun-2012  mrg sync to latest -current.
 1.12.4.2  22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12.4.1  30-Oct-2012  yamt sync with head
 1.13.2.4  03-Dec-2017  jdolecek update from HEAD
 1.13.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.2.2  23-Jun-2013  tls resync from head
 1.13.2.1  25-Feb-2013  tls resync with head
 1.16.2.1  18-May-2014  rmind sync with head
 1.17.2.1  10-Aug-2014  tls Rebase.
 1.19.2.7  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.19.2.6  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.19.2.5  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.19.2.4  26-Feb-2016  snj branches: 1.19.2.4.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.19.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.19.2.2  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.19.2.1  29-Aug-2014  martin Pull up following revision(s) (requested by msaitoh in ticket #61):
sys/dev/pci/if_wm.c: revision 1.290
sys/dev/pci/if_wmvar.h: revision 1.20
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.
 1.19.2.4.2.2  13-Mar-2017  skrll Sync with netbsd-7-1-RELEASE
 1.19.2.4.2.1  18-Jan-2017  skrll Sync with netbsd-5
 1.23.2.6  28-Aug-2017  skrll Sync with HEAD
 1.23.2.5  05-Feb-2017  skrll Sync with HEAD
 1.23.2.4  05-Dec-2016  skrll Sync with HEAD
 1.23.2.3  29-May-2016  skrll Sync with HEAD
 1.23.2.2  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.23.2.1  06-Jun-2015  skrll Sync with HEAD
 1.31.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.31.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.32.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.33.6.12  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.33.6.11  04-Sep-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #1894):

sys/dev/pci/if_wmvar.h: revision 1.50
sys/dev/pci/if_wm.c: revision 1.783,1.784 via patch

Delay sending LINK_STATE_UP to prevent dropping packets on I35[04] and I21[01].

Some (not all) systems use I35[04] or I21[01] don't send packet soon
after linkup. The MAC send a packet to the PHY and any error is not
observed. This behavior causes a problem that gratuitous ARP and/or
IPv6 DAD packet are silently dropped. To avoid this problem, don't
call mii_pollstat() here which will send LINK_STATE_UP notification
to the upper layer. Instead, mii_pollstat() will be called in
wm_gmii_mediastatus() or mii_tick() will be called in wm_tick().

Note that the similar workaround is in Linux's igb driver though it's
only for I21[01].

OK'd by hikaru@ and knakahara@.

Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.
 1.33.6.10  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.33.6.9  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.33.6.8  23-Oct-2021  martin Pull up the following, requested by msaitoh in ticket #1701:

share/man/man4/wm.4 1.42
sys/dev/pci/files.pci 1.434
sys/dev/pci/if_wm.c 1.686-1.687,1.692-1.693,
1.697,1.699-1.703,
1.706-1.715 via patch
sys/dev/pci/if_wmvar.h 1.46

- Add missing drain for pcq in wm_stop_locked().
- Add support for I219V 15-19 and I219LM 16-19.
- Fix Tx stall.
- Use wm_flush_desc_rings() workaround more on I219.
- Change DMA physical address in wm_flush_desc_rings() to match other
OSes.
- Check return value correctly in wm_lv_jumbo_workaround_ich8lan().
- Add new sysctl hw.wmN.debug_flags. This sysctl can be used if
WM_DEBUG is set.
- Add some sysctl values for debugging TX/RX queues.
- WM_EVENT_COUNTER is enabled by default on 64 bit architectures.
- Remove extra unlock/lock processing around if_percpuq_enqueue().
- Refactor rxq->rxq_ptr updating.
- Stop legacy interrupts before calling softint.
- Disable printf()s in wm_flush_desc_rings() because the code is
verified.
- Print I219's version number.
- Uniform INTx/MSI handler's Tx/Rx behavior to MSI-X's one.
- Fix return value of interrupt handler.
- Only print an error about missing I/O BARs for chips that need it.
- Do not return a void value from a void function.
- Add new flag named WM_F_CRC_STRIP and use it. No functional change.
- Whitespace fixes. Fix comments. No functional change.
 1.33.6.7  04-Nov-2020  martin Pull up following revision(s) (requested by knakahara in ticket #1620):

sys/dev/pci/if_wm.c: revision 1.694
sys/dev/pci/if_wm.c: revision 1.695 (via patch)
sys/dev/pci/if_wmvar.h: revision 1.47

Add WMPHY_I350. Not used yet.

Workaround for ihphy and atphy(ICH*/PCH*, 82580 and I350).
These phys stop DMA while link is down which causes device timeout.
Fix PR/kern 40981
Reviewed and tested by msaitoh@n.o, thanks.
XXX pullup-[89]
 1.33.6.6  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.33.6.5  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.33.6.4  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.33.6.3  11-Aug-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #969):

sys/dev/pci/if_wm.c: revision 1.584
sys/dev/pci/if_wmvar.h: revision 1.39

Add MDIC_WA and CLSEMWA to snprintb() string for WM_F_* flags.

Fix two bugs for non-SERDES fiber. Tested on 82544EI(0x1009), 82545GM(0x1027),
82546GB(0x107a), 82571GB(0x105f), 82572EI(0x107e). Tested on SERDES
82580(0x150e (Winyao SERDES SFP)) and 82580(0x150e) as regression test:

- Fix a bug that the link can't detect in link interrupt function for
non-SERDES fiber. When the signal is detected & STATUS_LU == 0 & RXCW == 0,
it's required to set CTRL_SLU and CTRL_FD bit. wm_check_for_link() is the
function to do it. If a link status change interrupt occurred, call
wm_check_for_link() before checking current link status.

- Fix a bug that 82542 misunderstand fiber's signal detection. CTRL_SWDPIN(1)
is used for fiber's signal and it's value is reversed only on 82543 and
82544. Simplify the code and move it into a new function wm_tbi_havesignal()
and use it.
 1.33.6.2  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.33.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.37.2.3  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.37.2.2  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.37.2.1  16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.38.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.38.2.1  10-Jun-2019  christos Sync with HEAD
 1.44.4.7  18-Oct-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #1754):

sys/dev/pci/pcidevs: revision 1.1497
sys/dev/pci/if_wm.c: revision 1.790
sys/dev/pci/if_wm.c: revision 1.791
sys/dev/pci/if_wmvar.h: revision 1.51

pcidevs: Add Intel I219{V,LM}({22,23})

wm(4): Add a new workaround for Tiger Lake and newer.
- Define new WM_T_PCH_TGP and use it for Tiger Lake and newer.
Note that we don't define WM_T_PCH_ADP because we have no any
Alder Lake specific workaround yet.
- Add new workaround for Tiger Lake (and newer) in wm_init_locked()
to avoid packet loss.

wm(4): Add I219{V,LM}({22,23}) devices (Raptor Lake).
 1.44.4.6  04-Sep-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #344):

sys/dev/pci/if_wmvar.h: revision 1.50
sys/dev/pci/if_wm.c: revision 1.783,1.784 via patch

Delay sending LINK_STATE_UP to prevent dropping packets on I35[04] and I21[01].

Some (not all) systems use I35[04] or I21[01] don't send packet soon
after linkup. The MAC send a packet to the PHY and any error is not
observed. This behavior causes a problem that gratuitous ARP and/or
IPv6 DAD packet are silently dropped. To avoid this problem, don't
call mii_pollstat() here which will send LINK_STATE_UP notification
to the upper layer. Instead, mii_pollstat() will be called in
wm_gmii_mediastatus() or mii_tick() will be called in wm_tick().

Note that the similar workaround is in Linux's igb driver though it's
only for I21[01].

OK'd by hikaru@ and knakahara@.

Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.
 1.44.4.5  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.44.4.4  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.44.4.3  04-Nov-2020  martin Pull up following revision(s) (requested by knakahara in ticket #1126):

sys/dev/pci/if_wm.c: revision 1.694
sys/dev/pci/if_wm.c: revision 1.695 (via patch)
sys/dev/pci/if_wmvar.h: revision 1.47

Add WMPHY_I350. Not used yet.

Workaround for ihphy and atphy(ICH*/PCH*, 82580 and I350).
These phys stop DMA while link is down which causes device timeout.
Fix PR/kern 40981
Reviewed and tested by msaitoh@n.o, thanks.
XXX pullup-[89]
 1.44.4.2  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.44.4.1  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.48.4.3  18-Oct-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #421):

sys/dev/pci/pcidevs: revision 1.1497
sys/dev/pci/if_wm.c: revision 1.790
sys/dev/pci/if_wm.c: revision 1.791
sys/dev/pci/if_wmvar.h: revision 1.51

pcidevs: Add Intel I219{V,LM}({22,23})

wm(4): Add a new workaround for Tiger Lake and newer.
- Define new WM_T_PCH_TGP and use it for Tiger Lake and newer.
Note that we don't define WM_T_PCH_ADP because we have no any
Alder Lake specific workaround yet.
- Add new workaround for Tiger Lake (and newer) in wm_init_locked()
to avoid packet loss.

wm(4): Add I219{V,LM}({22,23}) devices (Raptor Lake).
 1.48.4.2  04-Sep-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #344):

sys/dev/pci/if_wmvar.h: revision 1.50
sys/dev/pci/if_wm.c: revision 1.783
sys/dev/pci/if_wm.c: revision 1.784

Delay sending LINK_STATE_UP to prevent dropping packets on I35[04] and I21[01].

Some (not all) systems use I35[04] or I21[01] don't send packet soon
after linkup. The MAC send a packet to the PHY and any error is not
observed. This behavior causes a problem that gratuitous ARP and/or
IPv6 DAD packet are silently dropped. To avoid this problem, don't
call mii_pollstat() here which will send LINK_STATE_UP notification
to the upper layer. Instead, mii_pollstat() will be called in
wm_gmii_mediastatus() or mii_tick() will be called in wm_tick().

Note that the similar workaround is in Linux's igb driver though it's
only for I21[01].

OK'd by hikaru@ and knakahara@.

Fix #ifdef WM_DEBUG code in wm_gmii_i82544_{read,write}reg_locked.
 1.48.4.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