From a9686e40dc84da08cb5ab3eed52683603414041c Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sat, 7 Apr 2018 11:55:15 +0000 Subject: 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@ --- sys/dev/pci/if_em_hw.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sys/dev') 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); -- cgit v1.2.3