diff options
author | 2018-04-07 11:55:14 +0000 | |
---|---|---|
committer | 2018-04-07 11:55:14 +0000 | |
commit | fbd3ec527dc17bc0405596fb3bd59ed833d81e88 (patch) | |
tree | f61fb4d07fd7918317cb98288ee92a652d5e249b | |
parent | em: Increase delay after reset to 20ms (diff) | |
download | wireguard-openbsd-fbd3ec527dc17bc0405596fb3bd59ed833d81e88.tar.xz wireguard-openbsd-fbd3ec527dc17bc0405596fb3bd59ed833d81e88.zip |
em: Add em_check_phy_reset_block() quirk
Port the logic from freebsd to em_check_phy_reset_block(). A single
read does not seem to be reliable.
ok mikeb@ jsg@
-rw-r--r-- | sys/dev/pci/if_em_hw.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/dev/pci/if_em_hw.c b/sys/dev/pci/if_em_hw.c index 3cd8b792fe0..3815ca528db 100644 --- a/sys/dev/pci/if_em_hw.c +++ b/sys/dev/pci/if_em_hw.c @@ -31,7 +31,7 @@ *******************************************************************************/ -/* $OpenBSD: if_em_hw.c,v 1.98 2018/04/07 11:53:53 sf Exp $ */ +/* $OpenBSD: if_em_hw.c,v 1.99 2018/04/07 11:55:14 sf Exp $ */ /* * if_em_hw.c Shared functions for accessing and configuring the MAC */ @@ -9539,9 +9539,18 @@ em_check_phy_reset_block(struct em_hw *hw) DEBUGFUNC("em_check_phy_reset_block\n"); if (IS_ICH8(hw->mac_type)) { - fwsm = E1000_READ_REG(hw, FWSM); - return (fwsm & E1000_FWSM_RSPCIPHY) ? E1000_SUCCESS : - E1000_BLK_PHY_RESET; + int i = 0; + int blocked = 0; + do { + fwsm = E1000_READ_REG(hw, FWSM); + if (!(fwsm & E1000_FWSM_RSPCIPHY)) { + blocked = 1; + msec_delay(10); + continue; + } + blocked = 0; + } while (blocked && (i++ < 30)); + return blocked ? E1000_BLK_PHY_RESET : E1000_SUCCESS; } if (hw->mac_type > em_82547_rev_2) manc = E1000_READ_REG(hw, MANC); |