diff options
author | Stefan Fritsch <sf@cvs.openbsd.org> | 2018-04-07 11:55:15 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@cvs.openbsd.org> | 2018-04-07 11:55:15 +0000 |
commit | a9686e40dc84da08cb5ab3eed52683603414041c (patch) | |
tree | 70c2936e84f73a42ce15eda7f07b558cf81b7c2b /sys/dev | |
parent | 455e0da3a4251e04068bb962395917f9569df179 (diff) |
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@
Diffstat (limited to 'sys/dev')
-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); |